postgresqlupgradeuninstallationodoo-13odoo-15

Odoo-sh Upgrade : How to disable a view / uninstall a module during upgrade process (v13 to v15)?


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:

enter image description here

My Try: using in Odoo-sh> SHELL-Tab, the shell command : psql:

...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 ??

enter image description here


Solution

  • 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)
        """)