From 84b6c46943f20b8dc77b390627fbfefa6a181327 Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Tue, 13 Mar 2018 09:41:43 +0100 Subject: [FIX] registry, loading: re-init inherited SQL views Before this commit: * Install any module that creates a SQL view and another that extends this view. e.g.: sale and pos_sale for `report.all.channels.sales`. * Uninstall the module that extended the SQL view. e.g.: uninstall pos_sale. * Try to access the view from the web client -> Traceback, table not found. This happens because when reloading the registry, postgres drops the sql view and it must be re-initialized. After this commit: We solve this issue by calculating all missing tables/views during the uninstallation process, and re-initializing all of them right before reloading the registry. Also remove sql-view hacks in the modules `sale` and `sale_margin`. Fixes #23528, #23529, #23530 --- odoo/modules/loading.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'odoo/modules/loading.py') diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index 81c90e2b728..426ec9bb653 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -403,7 +403,12 @@ def load_modules(db, force_demo=False, status=None, update_module=False): cr.commit() _logger.info('Reloading registry once more after uninstalling modules') api.Environment.reset() - return odoo.modules.registry.Registry.new(cr.dbname, force_demo, status, update_module) + registry = odoo.modules.registry.Registry.new( + cr.dbname, force_demo, status, update_module + ) + registry.check_tables_exist(cr) + cr.commit() + return registry # STEP 6: verify custom views on every model if update_module: -- cgit v1.2.3