-
-
Notifications
You must be signed in to change notification settings - Fork 794
Description
Today, it is needed to change the code of the apriori.py in the OpenUpgrade repo which encourages to do more project specific work in OpenUpgrade repo which will also discourage contributions back to OCA.
A nice way to handle this case should probably be documented in
https://oca.github.io/OpenUpgrade/devfaq.html
Below is an answer from @legalsylvain on this topic initially reported here: jcdrubay#3
I faced the same question several times in the past. Each time I solved with a custom branch of openupgrade with a commit adding custom GRAP changes. Not the better, but it works.
If we want to allow the possibility to add custom rename / merge it should not be done in a pre-migration script of a custom module in my opinion. Two reasons :
- the apriori.py is used both time. Once in
openupgrade_framework, once inupgrade_analysis. If custom values are set in a custom modules, analysis will be wrong. - in the openupgrade process the rename_modules / merge_modules is used at the very beginning of the upgrade (in the pre-migration.py script of the base module). AFAIK, at the end of the upgrade of base, the modules tree is recompputed (=order of the modules to update). If your custom modules is not renamed at this step, openupgrade will ignore it because it will not find the
komit_basemodule in your addons path.
So for me, the single solution I see is to add in the apriori.py file, something like :
_rename_modules = {
# Odoo
"crm_iap_lead": "crm_iap_mine",
# ....
}
def _get_custom_rename_modules():
# read the odoo.cfg file and search for a openupgrade_rename_modules section
custom_conf = odoo.tools.config.misc.get('openupgrade_rename_modules', {})
return {x:y for x,y in custom_conf.items()}
rename_modules = _rename_modules + _get_custom_rename_modules()
And in the odoo.cfg modules
[openupgrade_rename_modules]
audit_base=k3_audit_base
...
[openupgrade_merged_modules]