Skip to content

Commit 31939fc

Browse files
authored
Merge pull request OCA#5387 from Tecnativa/17.0-ou-imp-maintenance-maintenance_plan
[17.0][OU-IMP] maintenance: Compatibility with maintenance_plan
2 parents 1fa8d7c + ad52095 commit 31939fc

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

openupgrade_scripts/scripts/maintenance/17.0.1.0/pre-migration.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
# Copyright 2024 Tecnativa - Víctor Martínez
1+
# Copyright 2024-2025 Tecnativa - Víctor Martínez
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33
from openupgradelib import openupgrade
44

55

6+
def _maintenance_plan(env):
7+
"""Rename the fields if the maintenance_plan module was installed."""
8+
if openupgrade.column_exists(env.cr, "maintenance_request", "note"):
9+
openupgrade.rename_fields(
10+
env,
11+
[
12+
(
13+
"maintenance.request",
14+
"maintenance_request",
15+
"note",
16+
"instruction_text",
17+
),
18+
],
19+
)
20+
21+
622
def _maintenance_request_company_id(env):
723
"""We set the company_id value for requests that do not have it.
824
We get the value of what will be deductively most appropriate (equipment, team or
@@ -34,3 +50,4 @@ def _maintenance_request_company_id(env):
3450
@openupgrade.migrate()
3551
def migrate(env, version):
3652
_maintenance_request_company_id(env)
53+
_maintenance_plan(env)

0 commit comments

Comments
 (0)