Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| link_tracker | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| loyalty | | |
| loyalty |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| lunch | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
29 changes: 29 additions & 0 deletions openupgrade_scripts/scripts/loyalty/19.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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'---
Loading