File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
contract/migrations/18.0.2.0.0 Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ @openupgrade .migrate ()
7
+ def migrate (env , version ):
8
+ env .cr .execute (
9
+ """
10
+ SELECT name
11
+ FROM ir_module_module
12
+ WHERE state='uninstalled' AND name IN (
13
+ 'contract_line_successor', 'contract_termination');"""
14
+ )
15
+ uninstalled_modules = [x [0 ] for x in env .cr .fetchall ()]
16
+ no_update_xml_ids = {
17
+ "contract_line_successor" : [
18
+ "contract_line_cron_for_renew" ,
19
+ ],
20
+ "contract_termination" : [],
21
+ }
22
+ xmlids_spec = []
23
+ for new_module , moved_xml_ids in no_update_xml_ids .items ():
24
+ if new_module in uninstalled_modules :
25
+ xmlids_spec .extend ([f"{ new_module } .{ xml_id } " for xml_id in moved_xml_ids ])
26
+ if xmlids_spec :
27
+ openupgrade .delete_records_safely_by_xml_id (env , xmlids_spec )
Original file line number Diff line number Diff line change 1
1
# Copyright 2025 ACSONE SA/NV
2
- # License LGPL -3.0 or later (http://www.gnu.org/licenses/lgpl ).
2
+ # License AGPL -3.0 or later (http://www.gnu.org/licenses/agpl ).
3
3
from openupgradelib import openupgrade
4
4
5
5
@@ -72,12 +72,14 @@ def migrate(env, version):
72
72
env .cr , moved_model , "contract" , new_module
73
73
)
74
74
all_moved_xml_ids = {
75
- "contract_line_successor" : ["contract_line_wizard" ],
75
+ "contract_line_successor" : [
76
+ "contract_line_wizard" ,
77
+ "contract_line_cron_for_renew" ,
78
+ ],
76
79
"contract_termination" : [
77
80
"contract_terminate_reason_access_manager" ,
78
81
"contract_terminate_reason_access_user" ,
79
82
"can_terminate_contract" ,
80
- "can_terminate_contract" ,
81
83
"contract_contract_terminate_wizard" ,
82
84
],
83
85
}
You can’t perform that action at this time.
0 commit comments