From 781dcdf3963e6bdc1a9340cbc183c703b5491377 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 26 Oct 2023 11:26:30 +0200 Subject: [PATCH] [IMP] core: remove prefetch on Module during loading If upgrading a database across an addition of a new field to ir.module.module (which is uncommon but does happen), the field prefetching would try to load the field before the database schema had been upgraded, leading to a loading error. Since we *only* want / need the module's name, we can `search_fetch` to preload just the field we need, and avoid ancillary prefetching. It's a bit of an unnecessary optimisation compared to just turning prefetching off, but it's also simpler (shorter) here so... closes odoo/odoo#140010 X-original-commit: c0102ca5dc3507c39f5ae6406fd962419fb09c6e Signed-off-by: Xavier Morel (xmo) --- odoo/modules/loading.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index c3e315b446a..ad724f1d6e4 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -503,7 +503,7 @@ def load_modules(registry, force_demo=False, status=None, update_module=False): # check that all installed modules have been loaded by the registry Module = env['ir.module.module'] - modules = Module.search(Module._get_modules_to_load_domain(), order='name') + modules = Module.search_fetch(Module._get_modules_to_load_domain(), ['name'], order='name') missing = [name for name in modules.mapped('name') if name not in graph] if missing: _logger.error("Some modules are not loaded, some dependencies or manifest may be missing: %s", missing)