mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][IMP] contract: Don't set recurrence field for recurring_next_date as full computed
This commit is contained in:
@@ -162,11 +162,6 @@ class ContractAbstractContractLine(models.AbstractModel):
|
|||||||
def _compute_date_start(self):
|
def _compute_date_start(self):
|
||||||
self._set_recurrence_field("date_start")
|
self._set_recurrence_field("date_start")
|
||||||
|
|
||||||
@api.depends("contract_id.recurring_next_date", "contract_id.line_recurrence")
|
|
||||||
def _compute_recurring_next_date(self):
|
|
||||||
super()._compute_recurring_next_date()
|
|
||||||
self._set_recurrence_field("recurring_next_date")
|
|
||||||
|
|
||||||
@api.depends("display_type", "note_invoicing_mode")
|
@api.depends("display_type", "note_invoicing_mode")
|
||||||
def _compute_is_recurring_note(self):
|
def _compute_is_recurring_note(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
|||||||
@@ -314,6 +314,8 @@ class ContractContract(models.Model):
|
|||||||
"contract_line_ids.is_canceled",
|
"contract_line_ids.is_canceled",
|
||||||
)
|
)
|
||||||
def _compute_recurring_next_date(self):
|
def _compute_recurring_next_date(self):
|
||||||
|
# Compute the recurring_next_date on the contract based on the one
|
||||||
|
# defined on line level.
|
||||||
for contract in self:
|
for contract in self:
|
||||||
recurring_next_date = contract.contract_line_ids.filtered(
|
recurring_next_date = contract.contract_line_ids.filtered(
|
||||||
lambda l: (
|
lambda l: (
|
||||||
@@ -322,6 +324,8 @@ class ContractContract(models.Model):
|
|||||||
and (not l.display_type or l.is_recurring_note)
|
and (not l.display_type or l.is_recurring_note)
|
||||||
)
|
)
|
||||||
).mapped("recurring_next_date")
|
).mapped("recurring_next_date")
|
||||||
|
# Take the earliest or set it as False if contract is stopped
|
||||||
|
# (no recurring_next_date).
|
||||||
contract.recurring_next_date = (
|
contract.recurring_next_date = (
|
||||||
min(recurring_next_date) if recurring_next_date else False
|
min(recurring_next_date) if recurring_next_date else False
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user