[FIX] website: remove useless code messing with action todos

With the new website scraper (see enterprise counterpart), there would
be a failing test / flow due to the `ir.actions.todo` introduced by this
new module.

This is because when the testing suite is run, this module is installed
and after choosing a theme for a website, the next action is fetch and
executed.

But that doesn't make sense anymore, it seems to be code leftover
messing around. On top of code leftover, it's also probably never what
we want as when choosing a theme, we want the user to be redirected to
his website. Other TODO actions should not alter that.

The `action_launch()` code removed here is was initially introduced with
commit [1] which was coming with an override of this method in website
but this override was removed with commit [2], nullyfing the need of
this call.

The condition to show the loaded which is removed here was introduced
with commit [3] in case the edit mode was requested.
But that "if edit mode" condition was actually removed with commit [4].

All in all, what we want is to always show the loader and always
redirect to the website.

[1]: https://github.com/odoo/odoo/commit/c1e0b03d8b5482a5150a0973e1ca48d70864a4e1
[2]: https://github.com/odoo/odoo/commit/e8a5af2e28a4724f86783746706cb59175f086bf#diff-2eb3a36c4664b647c665047166b246667200bf5f18ec53c640a9612b0d5e06ceL69
[3]: https://github.com/odoo/odoo/commit/1ff7f1e8b6b5539311f94f9828d203ec233daccb
[4]: https://github.com/odoo/odoo/commit/e38808e1a77dab291beb4020a2bf3c248f88cdef

closes odoo/odoo#141450

Related: odoo/enterprise#50161
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Romain Derie
2023-11-07 19:32:20 +00:00
parent 3e179ad437
commit a23e19cf95
+2 -8
View File
@@ -406,14 +406,8 @@ class IrModuleModule(models.Model):
request.update_context(apply_new_theme=True)
self._theme_upgrade_upstream()
active_todo = self.env['ir.actions.todo'].search([('state', '=', 'open')], limit=1)
result = None
if active_todo:
result = active_todo.action_launch()
else:
result = website.button_go_website()
if result.get('tag') == 'website_preview' and result.get('context', {}).get('params'):
result['context']['params']['with_loader'] = True
result = website.button_go_website()
result['context']['params']['with_loader'] = True
return result
def button_remove_theme(self):