diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index e7f797ce076..998d7e667d8 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -698,7 +698,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | link_tracker | |No DB layout changes. | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| loyalty | | | +| loyalty |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | lunch | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/loyalty/19.0.1.0/post-migration.py b/openupgrade_scripts/scripts/loyalty/19.0.1.0/post-migration.py index c5607dd9ad4..41660e77d70 100644 --- a/openupgrade_scripts/scripts/loyalty/19.0.1.0/post-migration.py +++ b/openupgrade_scripts/scripts/loyalty/19.0.1.0/post-migration.py @@ -3,11 +3,4 @@ @openupgrade.migrate() def migrate(env, version): - """Reset "lang" field for these records, as they were set in previous - version in XML, but not in this one, and Odoo doesn't reset non present - fields. - """ - for xmlid in ("mail_template_gift_card", "mail_template_loyalty_card"): - template = env.ref(f"loyalty.{xmlid}", False) - if template: - template.lang = False + openupgrade.load_data(env, "loyalty", "19.0.1.0/noupdate_changes.xml") diff --git a/openupgrade_scripts/scripts/loyalty/19.0.1.0/pre-migration.py b/openupgrade_scripts/scripts/loyalty/19.0.1.0/pre-migration.py new file mode 100644 index 00000000000..1583a718c4a --- /dev/null +++ b/openupgrade_scripts/scripts/loyalty/19.0.1.0/pre-migration.py @@ -0,0 +1,29 @@ +from openupgradelib import openupgrade + + +def fix_template_lang(env): + """Reset "lang" field for these records, as they were set in previous + version in XML, but not in this one, and Odoo doesn't reset non present + fields. + The templates are not marked as noupdate, so this change is not caught by + upgrade_analysis + """ + env.cr.execute( + """ + UPDATE mail_template + SET lang=NULL + FROM + ir_model_data imd + WHERE + imd.module='loyalty' and imd.name in ( + 'mail_template_gift_card', + 'mail_template_loyalty_card' + ) + and mail_template.id=imd.res_id + """ + ) + + +@openupgrade.migrate() +def migrate(env, version): + fix_template_lang(env) diff --git a/openupgrade_scripts/scripts/loyalty/19.0.1.0/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/loyalty/19.0.1.0/upgrade_analysis_work.txt new file mode 100644 index 00000000000..0dd7977ea42 --- /dev/null +++ b/openupgrade_scripts/scripts/loyalty/19.0.1.0/upgrade_analysis_work.txt @@ -0,0 +1,7 @@ +---Models in module 'loyalty'--- +---Fields in module 'loyalty'--- +loyalty / loyalty.reward / tax_ids (many2many) : DEL relation: account.tax + +# NOTHING TO DO + +---XML records in module 'loyalty'---