diff options
| author | Sylvain GARANCHER <sylvain.garancher@syleam.fr> | 2017-06-30 11:05:25 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2017-07-06 10:41:26 +0200 |
| commit | b587ae48e4976fe139aa57735f9312d0eb77cf25 (patch) | |
| tree | d48054c949ed5f38191781422701c7926d5fdb3e | |
| parent | 6d6c24cfb259d19dbb591f42e29b777b9ba57c30 (diff) | |
[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
| -rw-r--r-- | addons/mrp/wizard/change_production_qty.py | 2 | ||||
| -rw-r--r-- | addons/mrp/wizard/change_production_qty_views.xml | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index eebf8d29962..463c30c0a7c 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -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 diff --git a/addons/mrp/wizard/change_production_qty_views.xml b/addons/mrp/wizard/change_production_qty_views.xml index 0ba2fc8488e..f731d2cecc1 100644 --- a/addons/mrp/wizard/change_production_qty_views.xml +++ b/addons/mrp/wizard/change_production_qty_views.xml @@ -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" |
