mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][IMP] contract: simplify compute as False values are already taken into account
In get_next_invoice_date, False values are already taken into account, so, simplifying compute_recurring_next_date function.
This commit is contained in:
@@ -95,8 +95,7 @@ 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):
|
||||||
records_with_date_start = self.filtered("next_period_date_start")
|
for rec in self:
|
||||||
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,
|
||||||
@@ -105,11 +104,6 @@ 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):
|
||||||
|
|||||||
Reference in New Issue
Block a user