[FIX] mrp: fix tracked by products

From the backend manufacturing order view, it was no longer possible
to specify batches/serial numbers for by-products.
Now it is.

closes odoo/odoo#140446

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
JF Aubert
2023-11-03 13:33:28 +00:00
parent 231c519f74
commit bc5392b24c
+12 -4
View File
@@ -419,8 +419,8 @@
help="Displays the consumed Lot/Serial Numbers."
groups="stock.group_production_lot"
readonly="1"
column_invisible="not parent.show_lot_ids"
invisible="not show_details_visible or parent.state == 'draft'"
column_invisible="not parent.show_lot_ids or parent.state == 'draft'"
invisible="not show_details_visible"
options="{'create': [('parent.use_create_components_lots', '!=', False)]}"
context="{'default_company_id': company_id, 'default_product_id': product_id}"
domain="[('product_id','=',product_id)]"/>
@@ -432,7 +432,10 @@
<field name="workorder_ids" readonly="state == 'cancel' or (state == 'done' and is_locked)" context="{'tree_view_ref': 'mrp.mrp_production_workorder_tree_editable_view', 'default_product_uom_id': product_uom_id, 'from_manufacturing_order': True}"/>
</page>
<page string="By-Products" name="finished_products" groups="mrp.group_mrp_byproducts">
<field name="move_byproduct_ids" context="{'default_date': date_finished, 'default_date_deadline': date_deadline, 'default_location_id': production_location_id, 'default_location_dest_id': location_dest_id, 'default_state': 'draft', 'default_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id}" readonly="state == 'cancel' or (state == 'done' and is_locked)" options="{'delete': [('state', '=', 'draft')]}">
<field name="move_byproduct_ids"
widget="mrp_production_components_x2many"
context="{'default_date': date_finished, 'default_date_deadline': date_deadline, 'default_location_id': production_location_id, 'default_location_dest_id': location_dest_id, 'default_state': 'draft', 'default_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id, 'form_view_ref': 'stock.view_stock_move_operations'}"
readonly="state == 'cancel' or (state == 'done' and is_locked)" options="{'delete': [('state', '=', 'draft')]}">
<tree default_order="is_done,sequence" decoration-muted="is_done" editable="bottom">
<field name="product_id" context="{'default_detailed_type': 'product'}" domain="[('id', '!=', parent.product_id)]" required="1" readonly="state == 'done'"/>
<field name="location_dest_id" string="To" readonly="1" force_save="1" groups="stock.group_stock_multi_locations"/>
@@ -462,8 +465,13 @@
<field name="cost_share" optional="hide"/>
<field name="show_details_visible" column_invisible="True"/>
<field name="lot_ids" widget="many2many_tags"
optional="hide"
string="Lot/Serial Numbers"
help="Displays the produced Lot/Serial Numbers."
groups="stock.group_production_lot"
invisible="not show_details_visible or has_tracking != 'serial' or parent.state == 'draft'"
readonly="1"
column_invisible="not parent.show_lot_ids or parent.state == 'draft'"
invisible="not show_details_visible"
options="{'create': [('parent.use_create_components_lots', '!=', False)]}"
context="{'default_company_id': company_id, 'default_product_id': product_id}"
domain="[('product_id','=',product_id)]"/>