[FIX] mrp: unlock a raw move line

Usecase to reproduce:
- Go on a Mo
- Edit and Unlock
- Produce the MO
- Update a raw move and add a move line

User error you quant write on product_qty fields.
product_qty represent the reserved quantity on move line as quant's UoM.
The system requires to write a product_uom_qty that represent the same
quantity but in the move line UoM.

Fix it by removing the fields from the view, so it's no more save.
Also set the quantity done as readonly if the lines are present in
the view.

closes odoo/odoo#32135

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Arnold Moyaux
2019-03-27 14:02:32 +00:00
parent 799ab73189
commit 27e9c9e011
+1 -2
View File
@@ -26,7 +26,7 @@
</div>
<label for="quantity_done" attrs="{'invisible': [('parent.state', '=', 'draft')]}"/>
<div class="o_row" attrs="{'invisible': [('parent.state', '=', 'draft')]}">
<span><field name="quantity_done" attrs="{'readonly': ['|', ('is_locked', '=', True), '|', ('finished_lots_exist', '=', True), ('has_tracking', '!=', 'none')]}" nolabel="1"/></span>
<span><field name="quantity_done" attrs="{'readonly': ['|', '|', ('move_line_ids', '!=', False), ('is_locked', '=', True), '|', ('finished_lots_exist', '=', True), ('has_tracking', '!=', 'none')]}" nolabel="1"/></span>
<span> / </span>
<span><field name="reserved_availability" nolabel="1"/></span>
</div>
@@ -55,7 +55,6 @@
<field name="lot_produced_id" options="{'no_open': True, 'no_create': True}" domain="[('id', 'in', parent.order_finished_lot_ids)]" invisible="not context.get('final_lots')"/>
<field name="product_uom_qty" string="Reserved" readonly="1"/>
<field name="qty_done"/>
<field name="product_qty" invisible="1"/>
<field name="workorder_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_uom_id" invisible="1"/>