odoo-addon-openupgrade-scripts 16.0.1.0.4.17__py3-none-any.whl → 16.0.1.0.4.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/openupgrade_scripts/scripts/event_booth/16.0.1.0/upgrade_analysis_work.txt +5 -0
- odoo/addons/openupgrade_scripts/scripts/event_booth_sale/16.0.1.1/post-migration.py +28 -0
- odoo/addons/openupgrade_scripts/scripts/event_booth_sale/16.0.1.1/upgrade_analysis_work.txt +15 -0
- odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py +49 -92
- odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/pre-migration.py +3 -3
- odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/upgrade_analysis_work.txt +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.17.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info}/METADATA +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.17.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info}/RECORD +10 -7
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.17.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info}/WHEEL +0 -0
- {odoo_addon_openupgrade_scripts-16.0.1.0.4.17.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright 2025 ForgeFlow S.L. (http://www.forgeflow.com)
|
2
|
+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
3
|
+
|
4
|
+
from openupgradelib import openupgrade
|
5
|
+
|
6
|
+
|
7
|
+
def fill_related_stored_fields(env):
|
8
|
+
openupgrade.logged_query(
|
9
|
+
env.cr,
|
10
|
+
"""UPDATE event_booth eb
|
11
|
+
SET price = ebc.price
|
12
|
+
FROM event_booth_category ebc
|
13
|
+
WHERE eb.booth_category_id = ebc.id
|
14
|
+
""",
|
15
|
+
)
|
16
|
+
openupgrade.logged_query(
|
17
|
+
env.cr,
|
18
|
+
"""UPDATE event_type_booth etb
|
19
|
+
SET price = ebc.price
|
20
|
+
FROM event_booth_category ebc
|
21
|
+
WHERE etb.booth_category_id = ebc.id
|
22
|
+
""",
|
23
|
+
)
|
24
|
+
|
25
|
+
|
26
|
+
@openupgrade.migrate()
|
27
|
+
def migrate(env, version):
|
28
|
+
fill_related_stored_fields(env)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---Models in module 'event_booth_sale'---
|
2
|
+
---Fields in module 'event_booth_sale'---
|
3
|
+
event_booth_sale / event.booth / price (float) : is now stored
|
4
|
+
event_booth_sale / event.type.booth / price (float) : is now stored
|
5
|
+
# DONE: post-migration: fill related stored fields
|
6
|
+
|
7
|
+
event_booth_sale / product.template / detailed_type (False) : selection_keys is now '['consu', 'course', 'event', 'event_booth', 'product', 'service']' ('['consu', 'event', 'event_booth', 'gift', 'product', 'service']')
|
8
|
+
# NOTHING TO DO
|
9
|
+
|
10
|
+
---XML records in module 'event_booth_sale'---
|
11
|
+
NEW ir.ui.view: event_booth_sale.event_booth_view_graph
|
12
|
+
NEW ir.ui.view: event_booth_sale.event_booth_view_pivot
|
13
|
+
NEW ir.ui.view: event_booth_sale.event_booth_view_tree_from_event
|
14
|
+
DEL ir.ui.view: event_booth_sale.event_booth_view_tree
|
15
|
+
# NOTHING TO DO
|
@@ -1,93 +1,14 @@
|
|
1
1
|
# Copyright 2023 Coop IT Easy (https://coopiteasy.be)
|
2
|
+
# Copyright 2024 Tecnativa - Víctor Martínez
|
2
3
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
3
4
|
|
4
5
|
import logging
|
5
6
|
|
6
7
|
from openupgradelib import openupgrade
|
7
|
-
from psycopg2.extensions import AsIs
|
8
8
|
|
9
9
|
_logger = logging.getLogger(__name__)
|
10
10
|
|
11
11
|
|
12
|
-
def warn_about_dataloss(cr, source_relation_table, relation_comodel_field):
|
13
|
-
"""Warn user about data loss when migrating data from many2many to
|
14
|
-
many2one.
|
15
|
-
|
16
|
-
:param source_relation_table: The many2many relation table
|
17
|
-
of the model that will be on the 'one' side of the relation
|
18
|
-
:param relation_comodel_field: The name of the column containing ids
|
19
|
-
of the 'many' part of the new relation.
|
20
|
-
"""
|
21
|
-
openupgrade.logged_query(
|
22
|
-
cr,
|
23
|
-
"""
|
24
|
-
SELECT DISTINCT %(relation_comodel_field)s
|
25
|
-
FROM %(source_relation_table)s
|
26
|
-
WHERE %(relation_comodel_field)s IN (
|
27
|
-
SELECT %(relation_comodel_field)s
|
28
|
-
FROM %(source_relation_table)s
|
29
|
-
GROUP BY %(relation_comodel_field)s
|
30
|
-
HAVING COUNT(*) > 1
|
31
|
-
)
|
32
|
-
""",
|
33
|
-
{
|
34
|
-
"source_relation_table": AsIs(source_relation_table),
|
35
|
-
"relation_comodel_field": AsIs(relation_comodel_field),
|
36
|
-
},
|
37
|
-
)
|
38
|
-
for res in cr.fetchall():
|
39
|
-
_logger.error(
|
40
|
-
"hr.plan.activity.type(%s,) is linked to several hr.plan. "
|
41
|
-
"hr.plan.activity.type can only be linked to one hr.plan. "
|
42
|
-
"Fix these data before migrating to avoid data loss.",
|
43
|
-
res[0],
|
44
|
-
)
|
45
|
-
|
46
|
-
|
47
|
-
def m2m_to_o2m(
|
48
|
-
env,
|
49
|
-
model,
|
50
|
-
field,
|
51
|
-
source_relation_table,
|
52
|
-
relation_source_field,
|
53
|
-
relation_comodel_field,
|
54
|
-
):
|
55
|
-
"""Transform many2many relations into one2many (with possible data
|
56
|
-
loss).
|
57
|
-
|
58
|
-
Use rename_tables() in your pre-migrate script to keep the many2many
|
59
|
-
relation table and give them as 'source_relation_table' argument.
|
60
|
-
And remove foreign keys constraints with remove_tables_fks().
|
61
|
-
|
62
|
-
:param model: The target registery model
|
63
|
-
:param field: The field that changes from m2m to o2m
|
64
|
-
:param source_relation_table: The (renamed) many2many relation table
|
65
|
-
:param relation_source_field: The column name of the 'model' id
|
66
|
-
in the relation table
|
67
|
-
:param relation_comodel_field: The column name of the comodel id in
|
68
|
-
the relation table
|
69
|
-
"""
|
70
|
-
columns = env[model]._fields.get(field)
|
71
|
-
target_table = env[columns.comodel_name]._table
|
72
|
-
target_field = columns.inverse_name
|
73
|
-
openupgrade.logged_query(
|
74
|
-
env.cr,
|
75
|
-
"""
|
76
|
-
UPDATE %(target_table)s AS target
|
77
|
-
SET %(target_field)s=source.%(relation_source_field)s
|
78
|
-
FROM %(source_relation_table)s AS source
|
79
|
-
WHERE source.%(relation_comodel_field)s=target.id
|
80
|
-
""",
|
81
|
-
{
|
82
|
-
"target_table": AsIs(target_table),
|
83
|
-
"target_field": AsIs(target_field),
|
84
|
-
"source_relation_table": AsIs(source_relation_table),
|
85
|
-
"relation_source_field": AsIs(relation_source_field),
|
86
|
-
"relation_comodel_field": AsIs(relation_comodel_field),
|
87
|
-
},
|
88
|
-
)
|
89
|
-
|
90
|
-
|
91
12
|
def create_work_contact(env):
|
92
13
|
"""Create work_contact_id for model hr.employee.base
|
93
14
|
|
@@ -182,21 +103,57 @@ def fill_master_department_id(cr):
|
|
182
103
|
)
|
183
104
|
|
184
105
|
|
185
|
-
|
186
|
-
|
187
|
-
|
106
|
+
def _hr_plan_activity_type_m2m_to_o2m(env):
|
107
|
+
"""Before, the activities in plans (hr.plan) were linked to the
|
108
|
+
plan_activity_type_ids field with a m2m field, now the field
|
109
|
+
is an o2m. We define the data in the table hr_plan_activity_type according to the
|
110
|
+
table ou_legacy_16_0_hr_plan_hr_plan_activity_type_rel that we have defined
|
111
|
+
previously in pre-migration to ensure that no data is lost.
|
112
|
+
"""
|
113
|
+
openupgrade.logged_query(
|
188
114
|
env.cr,
|
189
|
-
"
|
190
|
-
|
115
|
+
"""
|
116
|
+
UPDATE hr_plan_activity_type hpat
|
117
|
+
SET plan_id = rel.hr_plan_id
|
118
|
+
FROM ou_legacy_16_0_hr_plan_hr_plan_activity_type_rel rel
|
119
|
+
WHERE rel.hr_plan_activity_type_id = hpat.id
|
120
|
+
""",
|
191
121
|
)
|
192
|
-
|
193
|
-
env,
|
194
|
-
"
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
122
|
+
openupgrade.logged_query(
|
123
|
+
env.cr,
|
124
|
+
"""
|
125
|
+
INSERT INTO hr_plan_activity_type (
|
126
|
+
plan_id,
|
127
|
+
activity_type_id,
|
128
|
+
summary,
|
129
|
+
responsible,
|
130
|
+
responsible_id,
|
131
|
+
note,
|
132
|
+
create_uid,
|
133
|
+
create_date,
|
134
|
+
write_uid,
|
135
|
+
write_date
|
136
|
+
)
|
137
|
+
SELECT rel.hr_plan_id,
|
138
|
+
detail.activity_type_id,
|
139
|
+
detail.summary,
|
140
|
+
detail.responsible,
|
141
|
+
detail.responsible_id,
|
142
|
+
detail.note,
|
143
|
+
detail.create_uid,
|
144
|
+
detail.create_date,
|
145
|
+
detail.write_uid,
|
146
|
+
detail.write_date
|
147
|
+
FROM ou_legacy_16_0_hr_plan_hr_plan_activity_type_rel rel
|
148
|
+
JOIN hr_plan_activity_type detail ON rel.hr_plan_activity_type_id = detail.id
|
149
|
+
WHERE detail.plan_id != rel.hr_plan_id
|
150
|
+
""",
|
199
151
|
)
|
152
|
+
|
153
|
+
|
154
|
+
@openupgrade.migrate()
|
155
|
+
def migrate(env, version):
|
156
|
+
_hr_plan_activity_type_m2m_to_o2m(env)
|
200
157
|
fill_master_department_id(env.cr)
|
201
158
|
create_work_contact(env)
|
202
159
|
openupgrade.load_data(env.cr, "hr", "16.0.1.1/noupdate_changes.xml")
|
@@ -44,9 +44,9 @@ def migrate(env, version):
|
|
44
44
|
openupgrade.add_fields(env, _new_fields)
|
45
45
|
# Backup Many2many relation between hr.plan and hr.plan.activity.type
|
46
46
|
openupgrade.remove_tables_fks(env.cr, ["hr_plan_hr_plan_activity_type_rel"])
|
47
|
-
# get_legacy_name cannot be used here,
|
48
|
-
#
|
49
|
-
# openupgradelib, we will
|
47
|
+
# get_legacy_name cannot be used here, as there is a length limit in table name,
|
48
|
+
# and it causes a conflict. Waiting for a fix in
|
49
|
+
# openupgradelib, we will use a new table name here.
|
50
50
|
openupgrade.rename_tables(
|
51
51
|
env.cr,
|
52
52
|
[
|
@@ -43,7 +43,7 @@ hr / hr.employee / work_email (char) : now a
|
|
43
43
|
|
44
44
|
hr / hr.plan / plan_activity_type_ids (many2many): table is now 'False' ('hr_plan_hr_plan_activity_type_rel')
|
45
45
|
hr / hr.plan / plan_activity_type_ids (many2many): type is now 'one2many' ('many2many')
|
46
|
-
# DONE: pre-migration and post-migration: move data from many2many table to plan_id
|
46
|
+
# DONE: pre-migration and post-migration: move data from many2many table to plan_id column in hr.plan.activity.type
|
47
47
|
|
48
48
|
hr / hr.plan.activity.type / plan_id (many2one) : NEW relation: hr.plan
|
49
49
|
# DONE: see plan_activity_type_ids from hr.plan
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: odoo-addon-openupgrade_scripts
|
3
|
-
Version: 16.0.1.0.4.
|
3
|
+
Version: 16.0.1.0.4.23
|
4
4
|
Summary: Module that contains all the migrations analysis and scripts for migrating Odoo SA modules.
|
5
5
|
Home-page: https://github.com/OCA/OpenUpgrade
|
6
6
|
Author: Odoo Community Association (OCA)
|
@@ -113,7 +113,10 @@ odoo/addons/openupgrade_scripts/scripts/event/16.0.1.7/upgrade_analysis.txt,sha2
|
|
113
113
|
odoo/addons/openupgrade_scripts/scripts/event/16.0.1.7/upgrade_analysis_work.txt,sha256=I-TIsTt1CEJD9JICyTGz-XXYfrQAYR15LeGWyqlqJno,1859
|
114
114
|
odoo/addons/openupgrade_scripts/scripts/event_booth/16.0.1.0/noupdate_changes.xml,sha256=9pP2FaOlk76ZD25AUR4iiskwsu7eFEX2-ZdloTXMWiY,968
|
115
115
|
odoo/addons/openupgrade_scripts/scripts/event_booth/16.0.1.0/upgrade_analysis.txt,sha256=VT5piP6BrwFrVXVM5nHCCfNSqVX9KGqv7-O7pbgkOrM,218
|
116
|
+
odoo/addons/openupgrade_scripts/scripts/event_booth/16.0.1.0/upgrade_analysis_work.txt,sha256=VT5piP6BrwFrVXVM5nHCCfNSqVX9KGqv7-O7pbgkOrM,218
|
117
|
+
odoo/addons/openupgrade_scripts/scripts/event_booth_sale/16.0.1.1/post-migration.py,sha256=zu3Tt5mIp0ntp_eUWxqh1HziYH3ZMD4Gi4C0-Wdr30Y,717
|
116
118
|
odoo/addons/openupgrade_scripts/scripts/event_booth_sale/16.0.1.1/upgrade_analysis.txt,sha256=LSQQSfcwI6i6IHIlONNIPilj41EYFwwBV2XohbWvHjY,784
|
119
|
+
odoo/addons/openupgrade_scripts/scripts/event_booth_sale/16.0.1.1/upgrade_analysis_work.txt,sha256=AGz8niuclOZZ_1yxegPJJ0gMN1sv21IGKI4r-UP_pEY,869
|
117
120
|
odoo/addons/openupgrade_scripts/scripts/event_crm/16.0.1.0/upgrade_analysis.txt,sha256=fM9d2_K57GYqoLCxc_B7nPgCJNT0G-h5rhtu5VDDfJ4,177
|
118
121
|
odoo/addons/openupgrade_scripts/scripts/event_crm/16.0.1.0/upgrade_analysis_work.txt,sha256=7PDB2P-bpHemGKxLOScuRRUv7oTrFL4s6SiwThiHYzI,194
|
119
122
|
odoo/addons/openupgrade_scripts/scripts/event_sale/16.0.1.2/upgrade_analysis.txt,sha256=ehVvajkvMsWEYF3dFQJbWgmlUy9DQkqWGzF4t3cnfLM,867
|
@@ -140,10 +143,10 @@ odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/pre-migration.py,s
|
|
140
143
|
odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/upgrade_analysis.txt,sha256=T6iNOaVAnUJyuehQ1uwTr8C9cXKmZU_Mw3EQQ2hPu1c,685
|
141
144
|
odoo/addons/openupgrade_scripts/scripts/google_gmail/16.0.1.2/upgrade_analysis_work.txt,sha256=ZFiT39XdvjqP9MWdctq_OLT4yaKvi034a9tSmIarJsA,1395
|
142
145
|
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/noupdate_changes.xml,sha256=7Kh6ikV0c8llO66FzBlAXZuPURS0oJLO43aQSqKs9ow,950
|
143
|
-
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py,sha256=
|
144
|
-
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/pre-migration.py,sha256=
|
146
|
+
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/post-migration.py,sha256=C5QOo3xZjnbXTxqOjFIy2NSea0Z9Hu3GOszkBTZyk44,5844
|
147
|
+
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/pre-migration.py,sha256=GnxPms4HAtw7F2U6vRUJDUuRx4NXoUi83KS6KM5hqSc,1708
|
145
148
|
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/upgrade_analysis.txt,sha256=zxyq2l4x0UHfHfDhEX5m5ungWQP6JQ-MdIAruwiXhNU,3564
|
146
|
-
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/upgrade_analysis_work.txt,sha256=
|
149
|
+
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/upgrade_analysis_work.txt,sha256=LmcpH17tdDqs-8FyfIJ8fY90dsTzSot28do3jsq8HuA,4176
|
147
150
|
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/tests/__init__.py,sha256=qa6A81ih23FLWQOvNdNBfWYC2OTadV4u8KFIeOm4Ttc,32
|
148
151
|
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/tests/data.py,sha256=LswyfUF0owjdxQaiJGxY2wqCzFfthhDApb-v9r2VgBA,9908
|
149
152
|
odoo/addons/openupgrade_scripts/scripts/hr/16.0.1.1/tests/test_hr_migration.py,sha256=a8LNu8hi7cVc4xmuuz4_qpjZ-f2LDb_uELWPUAjlApI,2142
|
@@ -762,7 +765,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
|
|
762
765
|
odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
|
763
766
|
odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
764
767
|
odoo/addons/openupgrade_scripts/static/description/index.html,sha256=In9_GT_zstffKTETBxiyjfSzZz_5JtVugN-08tmDS6o,12722
|
765
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
766
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
767
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
768
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.4.
|
768
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info/METADATA,sha256=wbJaiHXiynJm62rNFjXIQNMA682MgwLQjGt4vuETNkA,3790
|
769
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
770
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
771
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.4.23.dist-info/RECORD,,
|
File without changes
|