During the upgrade process on odoo.sh on branch BrStaging, there are errors in the log panel. Some obsolete custom Modules or Views are the cause of these errors. To disable or uninstall them, we have to use SQL queries because we cannot enter odoo which cannot start:
My Try: using in Odoo-sh> SHELL-Tab, the shell command : psql:
To disable a view
UPDATE public.ir_ui_view SET active = false WHERE id = 10381;
To disable/uninstall a module
UPDATE ir_module_module set state='to remove'
WHERE name in ('my_custom_module') and state='installed';
...have tried that request too:
UPDATE ir_module_module set state='uninstallable'
WHERE name in ('my_custom_module') and state='installed';
...But it does t work: after a commit or restart (command: odoosh-restart) the related error still remains!
How to disable a view and uninstall a module during the upgrade process from v13 to v15 ??
The solution, I have found is using a pre-migrate.py file into one of my custom module : my_custom_module/migrations/15.0.0.0.0/pre-migrate.py which contain the Sql query that i need to execute, to correct the upgrade-log-Error:
def migrate(cr, version):
# TO CORRECT UPGRADE ERROR 1 : Element '<xpath expr="//xxxx">' cannot be located in parent view
cr.execute("""
update ir_ui_view v
set inherit_id = NULL, mode='primary', active = false
where
v.id in (10563,10539)
""")