[FIX] account_payment_order: add missing option "structured" to payment line ref type

The payment line reference type takes its value from the invoice reference
type, and both fields must have the same options.
The missing option "structured" causes a bug during payment creation.

the test is modified to be able to reproduce the problem.
This commit is contained in:
sbejaoui
2024-07-09 20:21:09 +02:00
parent 2f446b3dce
commit 2b75096e78
3 changed files with 5 additions and 4 deletions

View File

@@ -51,9 +51,7 @@ class AccountMove(models.Model):
"""Retrieve the communication string for this direct item."""
communication = self.payment_reference or self.ref or self.name
if self.is_invoice():
if (self.reference_type or "none") != "none":
communication = self.ref
elif self.is_purchase_document():
if self.is_purchase_document():
communication = self.ref or self.payment_reference
else:
communication = self.payment_reference or self.name

View File

@@ -78,7 +78,9 @@ class AccountPaymentLine(models.Model):
required=False, help="Label of the payment that will be seen by the destinee"
)
communication_type = fields.Selection(
selection=[("normal", "Free")], required=True, default="normal"
selection=[("normal", "Free"), ("structured", "Structured")],
required=True,
default="normal",
)
payment_ids = fields.Many2many(
comodel_name="account.payment",

View File

@@ -77,6 +77,7 @@ class TestPaymentOrderInboundBase(AccountTestInvoicingCommon):
invoice_line_form.price_unit = 100.0
invoice_line_form.account_id = self.invoice_line_account
invoice_line_form.tax_ids.clear()
invoice_form.reference_type = "structured"
invoice = invoice_form.save()
invoice_form = Form(invoice)
invoice_form.payment_mode_id = self.inbound_mode