[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
This commit is contained in:
committed by
Pierre Masereel
parent
4293a27b03
commit
10edfc7545
@@ -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',
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<button name="action_see_attachments" type="object" icon="fa-file" attrs="{'invisible': [('has_attachments', '=', True)]}" aria-label="Attachments" title="Attachments"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('product_ids.product_tmpl_id', '=', parent.product_tmpl_id)]" groups="product.group_product_variant"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('product_ids.product_tmpl_id', '=', parent.product_tmpl_id)]" attrs="{'column_invisible': [('parent.product_id', '!=', False)]}" groups="product.group_product_variant"/>
|
||||
<field name="operation_id" groups="mrp.group_mrp_routings" domain="[('routing_id', '=', parent.routing_id)]" options="{'no_quick_create':True,'no_create_edit':True}" attrs="{'column_invisible': [('parent.type', '=', 'phantom')]}"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user