[FIX] mrp: set default quantity

The wizard to change the produced quantity of a manufacturing order was not
using the current produced quantity as the default value.
This was because the field mo_id was not present in the view (and not in
`fields` in default_get).

Adding the field as invisible to compute the default value for mo_id.

Correct typo in dictory lookup (using `[` instead of `(`)

Closes #17937
opw-749725
This commit is contained in:
Sylvain GARANCHER
2017-07-06 10:41:26 +02:00
committed by Martin Trigaux
parent 6d6c24cfb2
commit b587ae48e4
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class ChangeProductionQty(models.TransientModel):
if 'mo_id' in fields and not res.get('mo_id') and self._context.get('active_model') == 'mrp.production' and self._context.get('active_id'):
res['mo_id'] = self._context['active_id']
if 'product_qty' in fields and not res.get('product_qty') and res.get('mo_id'):
res['product_qty'] = self.env['mrp.production'].browse(res.get['mo_id']).product_qty
res['product_qty'] = self.env['mrp.production'].browse(res['mo_id']).product_qty
return res
@api.model
@@ -10,6 +10,7 @@
<form string="Change Product Qty">
<group>
<field name="product_qty"/>
<field name="mo_id" invisible="1"/>
</group>
<footer>
<button name="change_prod_qty" string="Approve"