[13.0][FIX] contract: Impossible to create invoices from contract lines as section

This commit is contained in:
Denis Roussel
2021-01-31 17:36:51 +01:00
committed by Pedro M. Baeza
parent 9d4a80bc29
commit d17960dd51
3 changed files with 14 additions and 2 deletions

View File

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

View File

@@ -543,6 +543,9 @@ class ContractLine(models.Model):
name = self._insert_markers(dates[0], dates[1])
invoice_line_vals.update(
{
"account_id": invoice_line_vals["account_id"]
if "account_id" in invoice_line_vals and not self.display_type
else False,
"quantity": self._get_quantity_to_invoice(*dates),
"product_uom_id": self.uom_id.id,
"discount": self.discount,
@@ -1060,4 +1063,4 @@ class ContractLine(models.Model):
self, period_first_date, period_last_date, invoice_date
):
self.ensure_one()
return self.quantity
return self.quantity if not self.display_type else 0.0

View File

@@ -135,6 +135,15 @@ class TestContractBase(common.SavepointCase):
"recurring_rule_type": "monthly",
"date_start": "2018-02-15",
"contract_line_ids": [
(
0,
0,
{
"product_id": False,
"name": "Header for Services",
"display_type": "line_section",
},
),
(
0,
0,