diff options
| author | Arnold Moyaux <arm@odoo.com> | 2019-08-14 14:05:51 +0000 |
|---|---|---|
| committer | Arnold Moyaux <arm@odoo.com> | 2019-08-19 15:03:59 +0000 |
| commit | a3aeabd44d36dd735d4bfd78c65fc8f850578c60 (patch) | |
| tree | 1789d82e22d3d25bbee05751a27586fae5f7cbef /addons/mrp/wizard | |
| parent | d15137394153a912460f664653b359b3d2c17b53 (diff) | |
[FIX] mrp: do not base default on active_id
Since active_id do not works allows to use a context
key that will not be modified magically.
Diffstat (limited to 'addons/mrp/wizard')
| -rw-r--r-- | addons/mrp/wizard/mrp_product_produce.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py index 1c8c26fbd96..6cdde0f8ae4 100644 --- a/addons/mrp/wizard/mrp_product_produce.py +++ b/addons/mrp/wizard/mrp_product_produce.py @@ -16,8 +16,11 @@ class MrpProductProduce(models.TransientModel): @api.model def default_get(self, fields): res = super(MrpProductProduce, self).default_get(fields) - if self._context and self._context.get('active_id'): - production = self.env['mrp.production'].browse(self._context['active_id']) + production = self.env['mrp.production'] + production_id = self.env.context.get('default_production_id') or self.env.context.get('active_id') + if production_id: + production = self.env['mrp.production'].browse(production_id) + if production.exists(): serial_finished = (production.product_id.tracking == 'serial') todo_uom = production.product_uom_id.id todo_quantity = self._get_todo(production) @@ -68,7 +71,7 @@ class MrpProductProduce(models.TransientModel): self.ensure_one() self._record_production() action = self.production_id.open_produce_product() - action['context'] = {'active_id': self.production_id.id} + action['context'] = {'default_production_id': self.production_id.id} return action def action_generate_serial(self): |
