From 3e670dadace63f5cfe8175b92989b94b58ab2069 Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Tue, 10 May 2022 17:55:25 +0200 Subject: [PATCH] [12.0][IMP] add revision to name get of bom --- product_bom_revision/models/mrp.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/product_bom_revision/models/mrp.py b/product_bom_revision/models/mrp.py index cf0e935d6d01..e819c5c55ee0 100644 --- a/product_bom_revision/models/mrp.py +++ b/product_bom_revision/models/mrp.py @@ -1,10 +1,21 @@ # Copyright 2019 C2i Change 2 improve - Eduardo Magdalena # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import _, api, fields, models class MrpBom(models.Model): _inherit = 'mrp.bom' bom_revision = fields.Char(string="Revision") + + @api.multi + def name_get(self): + result = [] + for bom in self: + rec_name = "%s %s" % ( + _("[Rev. %s]") % bom.bom_revision if bom.bom_revision else '', + bom.product_tmpl_id.name, + ) + result.append((bom.id, rec_name)) + return result