From 1161905e97bccc5b7dcba33720a6662524320e64 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Mon, 2 Sep 2019 18:09:50 +0200 Subject: [PATCH] [ADD] Add start_date to contract_line display_name In order to help distinguishing lines with the same name --- product_contract/models/contract_line.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/product_contract/models/contract_line.py b/product_contract/models/contract_line.py index a298cbbe..c7838f3b 100644 --- a/product_contract/models/contract_line.py +++ b/product_contract/models/contract_line.py @@ -7,6 +7,7 @@ from odoo import api, fields, models class AccountAnalyticInvoiceLine(models.Model): _inherit = 'account.analytic.invoice.line' + _rec_name = 'display_name' sale_order_line_id = fields.Many2one( comodel_name="sale.order.line", @@ -51,3 +52,8 @@ class AccountAnalyticInvoiceLine(models.Model): rec.termination_notice_rule_type = ( rec.product_id.termination_notice_rule_type ) + + @api.depends('name', 'date_start') + def _compute_display_name(self): + for rec in self: + rec.display_name = ("%s - %s") % (rec.date_start, rec.name)