From f48ff0ddc60a9313479518c097c3f39c3adb48ba Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 19 Dec 2019 12:55:50 +0100 Subject: [PATCH] [12.0][FIX] - stop update recurring_next_date --- contract/models/contract_line.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contract/models/contract_line.py b/contract/models/contract_line.py index c9d475bd..176b81fb 100644 --- a/contract/models/contract_line.py +++ b/contract/models/contract_line.py @@ -540,7 +540,7 @@ class ContractLine(models.Model): def _onchange_date_start(self): for rec in self.filtered('date_start'): rec.recurring_next_date = self.get_next_invoice_date( - rec.date_start, + rec.next_period_date_start, rec.recurring_invoicing_type, rec.recurring_invoicing_offset, rec.recurring_rule_type, @@ -818,6 +818,17 @@ class ContractLine(models.Model): } if rec.last_date_invoiced == date_end: values['recurring_next_date'] = False + else: + values['recurring_next_date'] = \ + self.get_next_invoice_date( + rec.next_period_date_start, + rec.recurring_invoicing_type, + rec.recurring_invoicing_offset, + rec.recurring_rule_type, + rec.recurring_interval, + max_date_end=date_end, + ) + rec.write(values) if post_message: msg = _(