Skip to content

Commit cb1aa9a

Browse files
committed
[FIX] project: move migration scripts to new version folder
disable deactivating rating_project_request_email_template in xml, do it in code depending on rating being active
1 parent 9b0e9f4 commit cb1aa9a

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

openupgrade_scripts/scripts/project/19.0.1.3/end-migration.py renamed to openupgrade_scripts/scripts/project/19.0.1.4/end-migration.py

File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<!-- don't set template inactive unconditionally, happens in post-migration -->
4+
<xpath expr="./record[@id='rating_project_request_email_template']/field[@name='active']" position="replace" />
5+
</odoo>

openupgrade_scripts/scripts/project/19.0.1.3/post-migration.py renamed to openupgrade_scripts/scripts/project/19.0.1.4/post-migration.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ def project_task_type_rating(env):
5252
task_type.write(vals)
5353

5454

55+
def rating_project_request_email_template_active(env):
56+
"""
57+
Set project.rating_project_request_email_template's active flag based on rating
58+
being active for some task type
59+
"""
60+
env.ref("project.rating_project_request_email_template").active = bool(
61+
env["project.task.type"].search([("rating_active", "=", True)])
62+
)
63+
64+
5565
def project_task_priority(env):
5666
"""
5767
Map priorities of "1" (v18 high) to "2" (v19 high), but only if there are no
@@ -78,8 +88,14 @@ def project_task_priority(env):
7888
def migrate(env, version):
7989
project_project_allow_recurring_tasks(env)
8090
project_task_type_rating(env)
91+
rating_project_request_email_template_active(env)
8192
project_task_priority(env)
82-
openupgrade.load_data(env, "project", "19.0.1.3/noupdate_changes.xml")
93+
openupgrade.load_data(
94+
env,
95+
"project",
96+
"19.0.1.4/noupdate_changes.xml",
97+
xml_transformation_filename="19.0.1.4/noupdate_changes-transformation.xml",
98+
)
8399
openupgrade.delete_record_translations(
84100
env.cr,
85101
"project",

openupgrade_scripts/scripts/project/19.0.1.3/upgrade_analysis_work.txt renamed to openupgrade_scripts/scripts/project/19.0.1.4/upgrade_analysis_work.txt

File renamed without changes.

0 commit comments

Comments
 (0)