summaryrefslogtreecommitdiff
path: root/addons/website/models/ir_actions.py
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2020-10-26 14:51:38 +0000
committerJeremy Kersten <jke@odoo.com>2020-11-02 11:49:39 +0000
commite0cc28dcee977c4aa0c6a7e4ff6c463ab12e55a2 (patch)
tree413256e3bfcff5ded76e86866cbeb30fd50970b7 /addons/website/models/ir_actions.py
parent64a1a7b78782cb255a47d2e7d55d605c8175b6ce (diff)
[FIX] web_editor, website, *: improve post install theme and start tour
Before this commit, once you install website_* module, the ir.actions.todo from the installed module was overidded by the 'choose a theme' action. Now, when we consume this ir_act_todo, we re-open the open_menu that contains most of the time the expected next action from new module installed. Since we can also install module from the '+ new' button, in frontend, we considere that it first step of tour is to click on it, it is already done and we skip it. Install website_event Before: -> not redirected to /event (the ir.action.todo) -> no tour, if you don't click manually on '+ new' After: -> you are redirected to /event -> you can launch tour from '+ new' if you are already on the new panel, start direclty to the second step 'create event'
Diffstat (limited to 'addons/website/models/ir_actions.py')
-rw-r--r--addons/website/models/ir_actions.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/website/models/ir_actions.py b/addons/website/models/ir_actions.py
index 24fbc937514..305820503c7 100644
--- a/addons/website/models/ir_actions.py
+++ b/addons/website/models/ir_actions.py
@@ -60,3 +60,18 @@ class ServerAction(models.Model):
"""
res = super(ServerAction, self)._run_action_code_multi(eval_context)
return eval_context.get('response', res)
+
+
+class IrActionsTodo(models.Model):
+ _name = 'ir.actions.todo'
+ _inherit = 'ir.actions.todo'
+
+ def action_launch(self):
+ res = super().action_launch() # do ensure_one()
+
+ if self.id == self.env.ref('website.theme_install_todo').id:
+ # Pick a theme consume all ir.actions.todo by default (due to lower sequence).
+ # Once done, we re-enable the main ir.act.todo: open_menu
+ self.env.ref('base.open_menu').action_open()
+
+ return res