[IMP] contract_price_revision: Allows to restrict price revision on some lines

As if recurrence management is per line, some lines should be excluded from price revision.
This commit is contained in:
Denis Roussel
2022-08-08 18:42:11 +02:00
committed by Juanjo
parent f855853b7f
commit 43270bb5a9
9 changed files with 142 additions and 45 deletions

View File

@@ -20,6 +20,9 @@ class ContractLine(models.Model):
string="Variation %",
)
never_revise_price = fields.Boolean(
help="Check this if you don't want to allow price revision."
)
price_can_be_revised = fields.Boolean(
compute="_compute_price_can_be_revised",
help="Technical field in order to know if the line price can be revised.",
@@ -29,7 +32,8 @@ class ContractLine(models.Model):
def _compute_price_can_be_revised(self):
date_start = self.env.context.get("date_start", fields.Datetime.now())
lines_can_be_revised = self.filtered(
lambda line: not line.automatic_price
lambda line: not line.never_revise_price
and not line.automatic_price
and not line.successor_contract_line_id
and line.recurring_next_date
and not line.display_type