From 0554ffb339e5f90b0df3fb89ed2dbe6a8a223e7c Mon Sep 17 00:00:00 2001 From: yhu-odoo Date: Mon, 13 Jul 2020 12:29:24 +0000 Subject: [PATCH] [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 --- addons/mrp/wizard/mrp_consumption_warning.py | 8 +++++--- 1 file 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: