Skip to content

Commit 053db5e

Browse files
committed
[FIX] loyalty: incomplete migration
1 parent 8d7c9f4 commit 053db5e

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

docsource/modules180-190.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ Module coverage 18.0 -> 19.0
698698
+---------------------------------------------------+----------------------+-------------------------------------------------+
699699
| link_tracker | |No DB layout changes. |
700700
+---------------------------------------------------+----------------------+-------------------------------------------------+
701-
| loyalty | | |
701+
| loyalty |Done | |
702702
+---------------------------------------------------+----------------------+-------------------------------------------------+
703703
| lunch | | |
704704
+---------------------------------------------------+----------------------+-------------------------------------------------+

openupgrade_scripts/scripts/loyalty/19.0.1.0/post-migration.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,4 @@
33

44
@openupgrade.migrate()
55
def migrate(env, version):
6-
"""Reset "lang" field for these records, as they were set in previous
7-
version in XML, but not in this one, and Odoo doesn't reset non present
8-
fields.
9-
"""
10-
for xmlid in ("mail_template_gift_card", "mail_template_loyalty_card"):
11-
template = env.ref(f"loyalty.{xmlid}", False)
12-
if template:
13-
template.lang = False
6+
openupgrade.load_data(env, "loyalty", "19.0.1.0/noupdate_changes.xml")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from openupgradelib import openupgrade
2+
3+
4+
def fix_template_lang(env):
5+
"""Reset "lang" field for these records, as they were set in previous
6+
version in XML, but not in this one, and Odoo doesn't reset non present
7+
fields.
8+
The templates are not marked as noupdate, so this change is not caught by
9+
upgrade_analysis
10+
"""
11+
for xmlid in ("mail_template_gift_card", "mail_template_loyalty_card"):
12+
template = env.ref(f"loyalty.{xmlid}", False)
13+
if template:
14+
template.lang = False
15+
16+
17+
@openupgrade.migrate()
18+
def migrate(env, version):
19+
fix_template_lang(env)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---Models in module 'loyalty'---
2+
---Fields in module 'loyalty'---
3+
loyalty / loyalty.reward / tax_ids (many2many) : DEL relation: account.tax
4+
5+
# NOTHING TO DO
6+
7+
---XML records in module 'loyalty'---

0 commit comments

Comments
 (0)