[FIX] mrp: finished move lines view does not show lot

The stock_move_line view for finished product on MO was
the classic one which shows lot_name and other useless stuff

This commit improve it by using the lot_id instead and a new
view that only contains relevant information for the end user.
This commit is contained in:
amoyaux
2017-10-20 16:06:28 +02:00
parent 41d91e2c96
commit f6c89de81e
3 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -107,7 +107,7 @@ class MrpProduction(models.Model):
copy=False, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
domain=[('scrapped', '=', False)])
finished_move_line_ids = fields.One2many(
'stock.move.line', compute='_compute_lines', inverse='_inverse_lines',
'stock.move.line', compute='_compute_lines', inverse='_inverse_lines', string="Finished Product"
)
workorder_ids = fields.One2many(
'mrp.workorder', 'production_id', 'Work Orders',
+1 -1
View File
@@ -131,7 +131,7 @@
</field>
</page>
<page string="Finished Products">
<field name="finished_move_line_ids" attrs="{'readonly': [('is_locked', '=', True)], 'invisible': [('finished_move_line_ids', '=', [])]}">
<field name="finished_move_line_ids" context="{'form_view_ref': 'mrp.view_finisehd_move_line'}" attrs="{'readonly': [('is_locked', '=', True)], 'invisible': [('finished_move_line_ids', '=', [])]}">
<tree default_order="done_move" editable="bottom" create="0" delete="0" decoration-muted="state in ('done', 'cancel')">
<field name="product_id" readonly="1"/>
<field name="lot_id" groups="stock.group_production_lot" domain="[('product_id', '=', product_id)]" context="{'default_product_id': product_id}" attrs="{'invisible': [('lots_visible', '=', False)]}"/>
+22
View File
@@ -63,6 +63,28 @@
</field>
</record>
<record id="view_finisehd_move_line" model="ir.ui.view">
<field name="name">mrp.finished.move.line.form</field>
<field name="model">stock.move.line</field>
<field name="arch" type="xml">
<form string="Finished Product">
<group>
<group>
<field name="product_id" readonly="1"/>
<label for="qty_done" string ="Quantity"/>
<div class="o_row">
<span><field name="qty_done" readonly="1" nolabel="1"/></span>
<span>/</span>
<span><field name="product_uom_qty" readonly="1" nolabel="1"/></span>
<span><field name="product_uom_id" attrs="{'readonly': [('id', '!=', False)]}" nolabel="1"/></span>
</div>
<field name="lot_id" string="Lot/Serial number" groups="stock.group_production_lot" readonly="1" attrs="{'invisible': [('lots_visible', '=', False)]}"/>
</group>
</group>
</form>
</field>
</record>
<menuitem id="menu_mrp_traceability"
name="Traceability: Lots"
parent="menu_mrp_reporting"