Search code examples
migrationodooupgradeodoo-12

How can I Upgrade ODoo Module V12 to V13?


I want to upgrade my Odoo module V12 to V13 Please guide me how can I do that. And can I upgrade just single module in ODOO 12? Please guide me step by step.


Solution

  • You can try Tasks to do in the migration listed above.

    • Bump module version to 13.0.1.0.0.
    • Remove any possible migration script from previous version.
    • Squash administrative commits (if any) with the previous commit for reducing commit noise. They are named as "[UPD] README.rst", "[UPD] Update $MODULE.pot", "Update translation files" and similar names, and comes from OCA-git-bot, oca-travis or oca-transbot.
    • Remove all the decorators @api.multi, @api.returns, @api.one, @api.cr, @api.model_cr from the code. Now they are all multi-record by default. In case of the last ones, you will need to adapt the code to the behavior change.
    • Check that all "compute" methods of non-stored computed fields assign a value in any case to the field, even if it is a falsy one. (https://github.com/odoo/odoo/pull/36743/commits/2e43bfc1c4b2f61e0459614f61f90a77dc3b7233).
    • Computed stored fields will keep their previous value if not assigned during the compute method, so don't rely on any expected default value.
    • Replace sudo(user): "deprecated use of sudo(user), use with_user(user) instead"
    • Some of the Font Awesome (FA) icons have changed their name as now Odoo uses FA v5, so you might need to change them in your module views. Check the changed names in https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes.
    • Remove all the oldname field attributes in the code. If they were added in previous version, they have served their function any way, and now in this version it's not supported, so if you have the need, create a migration script and use openupgradelib's rename_fields method.
    • Remove view_type tag on action window XML definition. It's now always form (tree is not supported since 11.0 any way).
    • Remove multi field from ir.actions.act_window models. Now you have binding_view_types field for indicating in which view the action will be available: list, form or empty for both. If declaring the action through the accelerator tag <act_window>, then use the attribute binding_views. More reference in https://github.com/odoo/odoo/pull/24738/commits/33d51480688065e367eb646f12b89d721749cac9.
    • If having an smart-button for active field, with widget toggle_button, the archive/unarchive actions are available without doing anything more, so you can remove it. And the new paradigm is to put instead a ribbon when archived with the code <widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>.
    • If using any decimal precision in float fields (example: import odoo.addons.decimal_precision as dp; x = fields.Float(digits=dp.get_precision("Account"))), now the qualifier is put directly without the need of importing anything and simplifying syntax: x = fields.Float(digits="Account").
    • In the manifest, rename python dependencies to use the PyPI distribution name instead of the import name (see https://github.com/odoo/odoo/pull/25549 for more information)
    • If the module is touching Accounting part, see https://github.com/OCA/maintainer-tools/issues/430 for the structural changes detected in it.
    • Add tests to increase code coverage.
    • Check tasks of previous versions if you are migrating from lower versions than v12. It's also recommended to check for things not done in previous migrations.
    • Do the rest of the changes you need to do for making the module works on new version.

    Regex which can help to find the things to remove/change:

    grep -nri 'oldname\|sudo([^\)]\+)\|api.multi\|api.returns\|api.one\|api.cr\|api.model_cr\|12.0\|compute=' $MODULE