How to use the openupgradelib.openupgrade.rename_models function in openupgradelib

To help you get started, we’ve selected a few openupgradelib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopinvader / odoo-shopinvader / shopinvader / migrations / 10.0.2.0.0 / pre-migrate.py View on Github external
def migrate(cr, version):
    """Update database from previous versions, after updating module."""
    openupgrade.rename_tables(
        cr=cr, table_spec=[("locomotive_backend", "shopinvader_backend")]
    )
    openupgrade.rename_models(
        cr=cr, model_spec=[("locomotive.backend", "shopinvader.backend")]
    )
    # remove blocking view
    cr.execute(
        """DELETE FROM ir_ui_view
        WHERE arch_db ilike '%locomotive_backend_ids%'"""