From 6ff21e2e0ebc7761c5ba6ff8aad6d238253b56ff Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Fri, 11 Mar 2022 14:37:46 +0000 Subject: [PATCH] [FIX] core: support controllers outside addons With the iot-box it is possible to download modules from an odoo server into the iot-box. Those odoo modules are `exec`-like and exposed on the box. With those modules come some controllers. Because they were `exec`-like, they lack a python module name which makes `_generate_routing_rules` to reject them. With this fix, we authorise to declare controllers outside of odoo addons. Those controllers cannot be extended, nor can they override other controllers. closes odoo/odoo#86275 Signed-off-by: Julien Castiaux --- odoo/http.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/odoo/http.py b/odoo/http.py index c49d73c587c..189ae9a9da4 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -577,6 +577,12 @@ def _generate_routing_rules(modules, nodb_only, converters=None): defined at the given ``modules`` (often system wide modules or installed modules). Modules in this context are Odoo addons. """ + # Controllers defined outside of odoo addons are outside of the + # controller inheritance/extension mechanism. + yield from (ctrl() for ctrl in Controller.children_classes.get('', [])) + + # Controllers defined inside of odoo addons can be extended in + # other installed addons. Rebuild the class inheritance here. highest_controllers = [] for module in modules: highest_controllers.extend(Controller.children_classes.get(module, []))