Skip to content
Snippets Groups Projects
Commit 0554ffb3 authored by yhu-odoo's avatar yhu-odoo Committed by Arnold Moyaux
Browse files

[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
parent 216985a1
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment