[IMP] mrp: UI Fix for Lot/serial column in MO form view

The commit modifies the following:
- add tooltip : 'Displays the consumed Lot/Serial Numbers consumed.'
- Change the column Serial Numbers to also display lot number
- Make the column read-only

task-2925474

Part-of: odoo/odoo#97588
This commit is contained in:
Triet Ngo
2022-09-02 14:17:58 +02:00
parent 562e01eb28
commit dae82e7aae
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -616,7 +616,7 @@ class MrpProduction(models.Model):
@api.depends('state', 'move_raw_ids')
def _compute_show_lot_ids(self):
for order in self:
order.show_lot_ids = order.state != 'draft' and any(m.product_id.tracking == 'serial' for m in order.move_raw_ids)
order.show_lot_ids = order.state != 'draft' and any(m.product_id.tracking != 'none' for m in order.move_raw_ids)
@api.depends('state', 'move_raw_ids')
def _compute_show_serial_mass_produce(self):
+6 -3
View File
@@ -346,9 +346,12 @@
<field name="manual_consumption" invisible="1" force_save="1"/>
<field name="show_details_visible" invisible="1"/>
<field name="lot_ids" widget="many2many_tags"
groups="stock.group_production_lot" optional="hide"
attrs="{'invisible': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')],
'readonly': ['|', '|', ('show_details_visible', '=', False), ('has_tracking', '!=', 'serial'), ('parent.state', '=', 'draft')],
optional="hide"
readonly="1"
string="Lot/Serial Numbers"
help="Displays the consumed Lot/Serial Numbers."
groups="stock.group_production_lot"
attrs="{'invisible': ['|', ('show_details_visible', '=', False), ('parent.state', '=', 'draft')],
'column_invisible': [('parent.show_lot_ids', '=', False)]}"
options="{'create': [('parent.use_create_components_lots', '!=', False)]}"
context="{'default_company_id': company_id, 'default_product_id': product_id}"