summaryrefslogtreecommitdiff
path: root/addons/mrp/wizard
diff options
context:
space:
mode:
authoryhu-odoo <yhu@odoo.com>2020-07-13 12:29:24 +0000
committerArnold Moyaux <arm@odoo.com>2020-07-16 14:48:16 +0000
commit0554ffb339e5f90b0df3fb89ed2dbe6a8a223e7c (patch)
tree92d17bb05c084ba49f7cd517e88a410449b490a9 /addons/mrp/wizard
parent216985a1805db8fb57d6216c0b90d9801f63e20b (diff)
[FIX] mrp: Return to previous view and close MO
When launch a consumption warning wizard by clicking the "Mark as done and close mo" button, always close the MO. And return to tree view if we open the tablet view from a 'start' button, return to workorder kanban if we open tablet from that. Task 2278147 X-original-commit: 4d03cf5e8d29933d5f96099f8f662c9084b20197
Diffstat (limited to 'addons/mrp/wizard')
-rw-r--r--addons/mrp/wizard/mrp_consumption_warning.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/mrp/wizard/mrp_consumption_warning.py b/addons/mrp/wizard/mrp_consumption_warning.py
index 022d88dbecf..bae87759f12 100644
--- a/addons/mrp/wizard/mrp_consumption_warning.py
+++ b/addons/mrp/wizard/mrp_consumption_warning.py
@@ -29,10 +29,12 @@ class MrpConsumptionWarning(models.TransientModel):
wizard.consumption = "strict" in consumption_map and "strict" or "warning" in consumption_map and "warning" or "flexible"
def action_confirm(self):
+ action_from_do_finish = False
if self.env.context.get('from_workorder'):
- if self.env.context.get('active_model') == 'mrp_workorder':
- return self.env['mrp.workorder'].browse(self.env.context.get('active_id')).do_finish()
- return self.mrp_production_ids.with_context(skip_consumption=True).button_mark_done()
+ if self.env.context.get('active_model') == 'mrp.workorder':
+ action_from_do_finish = self.env['mrp.workorder'].browse(self.env.context.get('active_id')).do_finish()
+ action_from_mark_done = self.mrp_production_ids.with_context(skip_consumption=True).button_mark_done()
+ return action_from_do_finish or action_from_mark_done
def action_cancel(self):
if self.env.context.get('from_workorder') and len(self.mrp_production_ids) == 1: