From 10edfc7545e95b79f88fbe1ea709ac722fd020b9 Mon Sep 17 00:00:00 2001 From: Jaykishan Solanki Date: Mon, 23 Oct 2017 16:53:02 +0530 Subject: [PATCH] [IMP] mrp: rename lalbel and hide variant columns When a product variant is set on a BOM, the column 'Variant' of bom lines is hidden as all lines will be applied for the specific variant. If there was any variant were set in this column, they are removed as it doesn't mean anything because we are working to a specific one. TASK-36708 --- addons/mrp/models/mrp_bom.py | 12 +++++++++--- addons/mrp/views/mrp_bom_views.xml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index d4e7ec36d49..c8b965a89c3 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -60,6 +60,12 @@ class MrpBom(models.Model): default=lambda self: self.env['res.company']._company_default_get('mrp.bom'), required=True) + @api.onchange('product_id') + def onchange_product_id(self): + if self.product_id: + for line in self.bom_line_ids: + line.attribute_value_ids = False + @api.constrains('product_id', 'product_tmpl_id', 'bom_line_ids') def _check_product_recursion(self): for bom in self: @@ -192,10 +198,10 @@ class MrpBomLine(models.Model): return self.env['uom.uom'].search([], limit=1, order='id').id product_id = fields.Many2one( - 'product.product', 'Product', required=True) + 'product.product', 'Component', required=True) product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id') product_qty = fields.Float( - 'Product Quantity', default=1.0, + 'Quantity', default=1.0, digits=dp.get_precision('Product Unit of Measure'), required=True) product_uom_id = fields.Many2one( 'uom.uom', 'Product Unit of Measure', @@ -215,7 +221,7 @@ class MrpBomLine(models.Model): 'mrp.bom', 'Parent BoM', index=True, ondelete='cascade', required=True) attribute_value_ids = fields.Many2many( - 'product.attribute.value', string='Variants', + 'product.attribute.value', string='Apply on Variants', help="BOM Product Variants needed form apply this line.") operation_id = fields.Many2one( 'mrp.routing.workcenter', 'Consumed in Operation', diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index 7e1ac928330..894e4790c15 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -66,7 +66,7 @@