[FIX] mrp: by-products typo + default type on product

Be consistent with by-products and byproducts. Only use by-products.
When a product is created from the BoM view, it has a default type
as storable product, set the same type when the product is created
from by-products tab.
This commit is contained in:
Arnold Moyaux
2019-04-12 12:50:34 +00:00
parent 1fac199517
commit b5780cf8bb
2 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -364,13 +364,13 @@ class MrpSubProduct(models.Model):
_name = 'mrp.subproduct'
_description = 'Byproduct'
product_id = fields.Many2one('product.product', 'Product', required=True)
product_id = fields.Many2one('product.product', 'By-product', required=True)
product_qty = fields.Float(
'Product Qty',
'Quantity',
default=1.0, digits=dp.get_precision('Product Unit of Measure'), required=True)
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure', required=True)
bom_id = fields.Many2one('mrp.bom', 'BoM', ondelete='cascade')
operation_id = fields.Many2one('mrp.routing.workcenter', 'Produced at Operation')
operation_id = fields.Many2one('mrp.routing.workcenter', 'Produced in Operation')
@api.onchange('product_id')
def onchange_product_id(self):
+4 -4
View File
@@ -69,15 +69,15 @@
</tree>
</field>
</page>
<page string="Byproducts" attrs="{'invisible': [('type','!=','normal')]}" groups="mrp.group_mrp_byproducts">
<page string="By-products" attrs="{'invisible': [('type','!=','normal')]}" groups="mrp.group_mrp_byproducts">
<field name="sub_products">
<tree string="Byproducts" editable="top">
<field name="product_id"/>
<tree string="By-products" editable="top">
<field name="product_id" context="{'default_type': 'product'}"/>
<field name="product_qty"/>
<field name="product_uom_id" groups="uom.group_uom"/>
<field name="operation_id" groups="mrp.group_mrp_routings" domain="[('routing_id', '=', parent.routing_id)]" options="{'no_quick_create':True,'no_create_edit':True}"/>
</tree>
<form string="Byproducts">
<form string="By-products">
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom_id" groups="uom.group_uom"/>