[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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user