[14.0][FIX] contract: Compute recurring_next_date for False values too

This commit is contained in:
Denis Roussel
2022-03-07 13:36:44 +01:00
parent 745dea14a4
commit b56236796b

View File

@@ -95,7 +95,8 @@ class ContractRecurrencyMixin(models.AbstractModel):
@api.depends("next_period_date_start") @api.depends("next_period_date_start")
def _compute_recurring_next_date(self): def _compute_recurring_next_date(self):
for rec in self.filtered("next_period_date_start"): records_with_date_start = self.filtered("next_period_date_start")
for rec in records_with_date_start:
rec.recurring_next_date = self.get_next_invoice_date( rec.recurring_next_date = self.get_next_invoice_date(
rec.next_period_date_start, rec.next_period_date_start,
rec.recurring_invoicing_type, rec.recurring_invoicing_type,
@@ -104,6 +105,11 @@ class ContractRecurrencyMixin(models.AbstractModel):
rec.recurring_interval, rec.recurring_interval,
max_date_end=rec.date_end, max_date_end=rec.date_end,
) )
(self - records_with_date_start).update(
{
"recurring_next_date": False,
}
)
@api.depends("last_date_invoiced", "date_start", "date_end") @api.depends("last_date_invoiced", "date_start", "date_end")
def _compute_next_period_date_start(self): def _compute_next_period_date_start(self):