From b587ae48e4976fe139aa57735f9312d0eb77cf25 Mon Sep 17 00:00:00 2001 From: Sylvain GARANCHER Date: Fri, 30 Jun 2017 11:05:25 +0200 Subject: [PATCH] [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 --- addons/mrp/wizard/change_production_qty.py | 2 +- addons/mrp/wizard/change_production_qty_views.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 @@
+