1

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:

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

enter image description here

1
  • How to perform update-request on the database used for the upgrade process ? Commented Nov 4, 2022 at 11:19

1 Answer 1

2

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)
    """)
Sign up to request clarification or add additional context in comments.

1 Comment

Right solution, also .../migration/0.0.0 folder would be possible to use. The reason why direct update of the database is not working is that the migration process starts with fresh copy from production instance and all changes done in the currently migrated database are thrown away. Changes would have to be done in the main DB and that is not a good idea. Alternatively is possible to uninstall all unused/old modules by hand on production instance, change code and then run migration. But the solution with pre-migration script looks more elegant :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.