Skip to content

Commit

Permalink
[IMP] l10n_be_iso20022_pain: check BBA structured communication on pa…
Browse files Browse the repository at this point in the history
…yment line


check BBA structured communication on payment line only if  the journal invoice reference model is "be"

Co-authored-by: Thomas Binsfeld (ACSONE) <[email protected]>
  • Loading branch information
sbejaoui and ThomasBinsfeld committed Jul 15, 2024
1 parent f65c848 commit 66da6f3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions l10n_be_iso20022_pain/models/account_payment_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
class AccountPaymentLine(models.Model):
_inherit = "account.payment.line"

@api.constrains("communication", "communication_type")
@api.constrains("order_id", "communication", "communication_type")
def _check_communication(self):
for rec in self:
if rec.communication_type == "structured" and not check_bbacomm(
rec.communication
if (
rec.order_id.journal_id.invoice_reference_model == "be"
and rec.communication_type == "structured"
and not check_bbacomm(rec.communication
):
raise ValidationError(_("Invalid BBA Structured Communication !"))

0 comments on commit 66da6f3

Please sign in to comment.