From f95c2b6750fb2ffb1c67c75ed510b809d3893752 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 8 Dec 2021 14:29:25 +0100 Subject: [PATCH] shopfloor.app: comp registry check reusable --- shopfloor_base/models/shopfloor_app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shopfloor_base/models/shopfloor_app.py b/shopfloor_base/models/shopfloor_app.py index 74eb5e4f41..272c3b45c6 100644 --- a/shopfloor_base/models/shopfloor_app.py +++ b/shopfloor_base/models/shopfloor_app.py @@ -252,9 +252,12 @@ def _prepare_endpoint_vals(self, service, method_name, route, routing_params): def _route_group(self): return f"{self._name}:{self.tech_name}" - def _get_services(self): + def _is_component_registry_ready(self): comp_registry = _component_databases.get(self.env.cr.dbname) - if not comp_registry or comp_registry and not comp_registry.ready: + return comp_registry and comp_registry.ready + + def _get_services(self): + if not self._is_component_registry_ready(): # No service is available before the registry has been loaded. # This is a very special case, when the odoo registry is being # built, it calls odoo.modules.loading.load_modules().