mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] product_contract: use _compute_display_name. Moved it to contract module.
This commit is contained in:
@@ -112,6 +112,10 @@ class ContractLine(models.Model):
|
||||
default=True,
|
||||
)
|
||||
|
||||
def _compute_display_name(self):
|
||||
for rec in self:
|
||||
rec.display_name = "%s - %s" % (rec.date_start, rec.name)
|
||||
|
||||
@api.depends(
|
||||
"last_date_invoiced", "date_start", "date_end", "contract_id.last_date_invoiced"
|
||||
)
|
||||
|
||||
@@ -16,7 +16,6 @@ class ContractLine(models.Model):
|
||||
required=False,
|
||||
copy=False,
|
||||
)
|
||||
display_name = fields.Char(compute="_compute_display_name_2")
|
||||
|
||||
def _prepare_invoice_line(self, move_form):
|
||||
res = super(ContractLine, self)._prepare_invoice_line(move_form)
|
||||
@@ -48,11 +47,3 @@ class ContractLine(models.Model):
|
||||
rec.termination_notice_rule_type = (
|
||||
rec.product_id.termination_notice_rule_type
|
||||
)
|
||||
|
||||
@api.depends("name", "date_start")
|
||||
def _compute_display_name_2(self):
|
||||
# FIXME: _compute_display_name depends on rec_name (display_name)
|
||||
# and this trigger a WARNING : display_name depends on itself;
|
||||
# please fix its decorator
|
||||
for rec in self:
|
||||
rec.display_name = ("%s - %s") % (rec.date_start, rec.name)
|
||||
|
||||
Reference in New Issue
Block a user