[FIX] contract: Cleanup values on line when invoicing

It seems that having several fields returned by `Form` as `False` that
are related to one2many inverse field, makes Odoo ORM mad, and get to
an unbalanced move when generating the invoice.

Cleaning these values assures to work without problems.

Not able to provide a regression test, as I don't get to reproduce the
conditions to happen in test environment, but the patch is safe and
harmless anyways.

TT30842
This commit is contained in:
Pedro M. Baeza
2021-07-01 17:54:25 +02:00
parent 964f3e5403
commit 29165e2854
2 changed files with 4 additions and 2 deletions

View File

@@ -11,7 +11,7 @@
{
"name": "Recurring - Contracts Management",
"version": "14.0.1.2.0",
"version": "14.0.1.2.1",
"category": "Contract Management",
"license": "AGPL-3",
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",

View File

@@ -546,7 +546,9 @@ class ContractContract(models.Model):
invoice_line_vals = line._prepare_invoice_line(move_form=move_form)
if invoice_line_vals:
# Allow extension modules to return an empty dictionary for
# nullifying line
# nullifying line. We should then cleanup certain values.
del invoice_line_vals["company_id"]
del invoice_line_vals["company_currency_id"]
invoice_vals["invoice_line_ids"].append((0, 0, invoice_line_vals))
invoices_values.append(invoice_vals)
# Force the recomputation of journal items