odoo-addon-openupgrade-scripts 18.0.1.0.0.55__py3-none-any.whl → 18.0.1.0.0.56__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/product/18.0.1.2/post-migration.py +73 -0
- odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/pre-migration.py +73 -0
- odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/upgrade_analysis_work.txt +106 -0
- odoo/addons/openupgrade_scripts/scripts/product/tests/data.py +15 -0
- odoo/addons/openupgrade_scripts/scripts/product/tests/test_migration.py +30 -0
- {odoo_addon_openupgrade_scripts-18.0.1.0.0.55.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info}/METADATA +1 -1
- {odoo_addon_openupgrade_scripts-18.0.1.0.0.55.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info}/RECORD +9 -4
- {odoo_addon_openupgrade_scripts-18.0.1.0.0.55.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info}/WHEEL +0 -0
- {odoo_addon_openupgrade_scripts-18.0.1.0.0.55.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright 2025 Hunki Enterprises BV
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
3
|
+
|
4
|
+
from openupgradelib import openupgrade, openupgrade_180
|
5
|
+
|
6
|
+
|
7
|
+
def product_document_sequence(env):
|
8
|
+
"""
|
9
|
+
Set sequence matching previous name only ordering
|
10
|
+
"""
|
11
|
+
openupgrade.logged_query(
|
12
|
+
env.cr,
|
13
|
+
"""
|
14
|
+
UPDATE product_document
|
15
|
+
SET sequence=sequence.sequence
|
16
|
+
FROM
|
17
|
+
(
|
18
|
+
SELECT
|
19
|
+
product_document.id, row_number() OVER (
|
20
|
+
PARTITION BY ir_attachment.res_id, ir_attachment.res_model
|
21
|
+
ORDER BY ir_attachment.name
|
22
|
+
) sequence
|
23
|
+
FROM
|
24
|
+
product_document
|
25
|
+
JOIN ir_attachment
|
26
|
+
ON product_document.ir_attachment_id=ir_attachment.id
|
27
|
+
) sequence
|
28
|
+
WHERE
|
29
|
+
sequence.id=product_document.id
|
30
|
+
AND product_document.sequence IS NULL
|
31
|
+
""",
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
def product_template_is_favorite(env):
|
36
|
+
"""
|
37
|
+
Set is_favorite flag based on priority
|
38
|
+
"""
|
39
|
+
openupgrade.logged_query(
|
40
|
+
env.cr,
|
41
|
+
"""
|
42
|
+
UPDATE
|
43
|
+
product_template
|
44
|
+
SET is_favorite = (priority IS NOT NULL AND priority != '0')
|
45
|
+
""",
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def res_partner_specific_property_product_pricelist(env):
|
50
|
+
"""
|
51
|
+
Get value for specific_property_product_pricelist from v17
|
52
|
+
property_product_pricelist
|
53
|
+
"""
|
54
|
+
old_field = env.ref("product.field_res_partner__property_product_pricelist")
|
55
|
+
openupgrade_180.convert_company_dependent(
|
56
|
+
env,
|
57
|
+
"res.partner",
|
58
|
+
"specific_property_product_pricelist",
|
59
|
+
old_field_id=old_field.id,
|
60
|
+
)
|
61
|
+
# convert_company_dependent might have created ir.default entries, wipe them
|
62
|
+
new_field = env.ref(
|
63
|
+
"product.field_res_partner__specific_property_product_pricelist"
|
64
|
+
)
|
65
|
+
env["ir.default"].search([("field_id", "=", new_field.id)]).unlink()
|
66
|
+
|
67
|
+
|
68
|
+
@openupgrade.migrate()
|
69
|
+
def migrate(env, version):
|
70
|
+
product_document_sequence(env)
|
71
|
+
product_template_is_favorite(env)
|
72
|
+
res_partner_specific_property_product_pricelist(env)
|
73
|
+
openupgrade_180.convert_company_dependent(env, "product.product", "standard_price")
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright 2025 Hunki Enterprises BV
|
2
|
+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
3
|
+
|
4
|
+
from openupgradelib import openupgrade
|
5
|
+
|
6
|
+
xmlid_renames = [
|
7
|
+
("product.group_discount_per_so_line", "sale.group_discount_per_so_line"),
|
8
|
+
]
|
9
|
+
|
10
|
+
column_creates = [
|
11
|
+
("product.attribute", "active", "boolean", "TRUE"),
|
12
|
+
("product.attribute.value", "active", "boolean", "TRUE"),
|
13
|
+
("product.pricelist.item", "display_applied_on", "char"),
|
14
|
+
("product.pricelist.item", "price_markup", "float"),
|
15
|
+
]
|
16
|
+
|
17
|
+
|
18
|
+
def rename_pos_models(env):
|
19
|
+
"""
|
20
|
+
pos.combo and pos.combo.line have been moved to product from point_of_sale and
|
21
|
+
renamed to product.combo and product.combo.item respectively
|
22
|
+
"""
|
23
|
+
if not openupgrade.table_exists(env.cr, "pos_combo"):
|
24
|
+
return
|
25
|
+
|
26
|
+
openupgrade.rename_tables(
|
27
|
+
env.cr,
|
28
|
+
[
|
29
|
+
("pos_combo", "product_combo"),
|
30
|
+
("pos_combo_line", "product_combo_item"),
|
31
|
+
],
|
32
|
+
)
|
33
|
+
openupgrade.rename_models(
|
34
|
+
env.cr,
|
35
|
+
[
|
36
|
+
("pos.combo", "product.combo"),
|
37
|
+
("pos.combo.line", "product.combo.item"),
|
38
|
+
],
|
39
|
+
)
|
40
|
+
openupgrade.rename_fields(
|
41
|
+
env,
|
42
|
+
[
|
43
|
+
("product.combo", "product_combo", "combo_line_ids", "combo_item_ids"),
|
44
|
+
("product.combo.item", "product_combo_item", "combo_price", "extra_price"),
|
45
|
+
],
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def fill_product_pricelist_item_columns(env):
|
50
|
+
"""
|
51
|
+
Set display_applied_on to '2_product_category' if applied_on is
|
52
|
+
'2_product_category', else '1_product'
|
53
|
+
Set price_markup = -price_discount
|
54
|
+
"""
|
55
|
+
env.cr.execute(
|
56
|
+
"""
|
57
|
+
UPDATE product_pricelist_item
|
58
|
+
SET
|
59
|
+
display_applied_on=CASE
|
60
|
+
WHEN applied_on='2_product_category' THEN '2_product_category'
|
61
|
+
ELSE '1_product'
|
62
|
+
END,
|
63
|
+
price_markup=-price_discount
|
64
|
+
"""
|
65
|
+
)
|
66
|
+
|
67
|
+
|
68
|
+
@openupgrade.migrate()
|
69
|
+
def migrate(env, version):
|
70
|
+
openupgrade.rename_xmlids(env.cr, xmlid_renames)
|
71
|
+
openupgrade.add_columns(env, column_creates)
|
72
|
+
fill_product_pricelist_item_columns(env)
|
73
|
+
rename_pos_models(env)
|
@@ -0,0 +1,106 @@
|
|
1
|
+
---Models in module 'product'---
|
2
|
+
new model product.combo
|
3
|
+
new model product.combo.item
|
4
|
+
# DONE: pre-migration: rename models and fields from point_of_sale models if installed
|
5
|
+
|
6
|
+
new model update.product.attribute.value [transient]
|
7
|
+
# NOTHING TO DO: new functionality
|
8
|
+
|
9
|
+
---Fields in module 'product'---
|
10
|
+
product / product.attribute / active (boolean) : NEW hasdefault: default
|
11
|
+
# DONE: added in pre-migration
|
12
|
+
|
13
|
+
product / product.attribute / template_value_ids (one2many) : NEW relation: product.template.attribute.value
|
14
|
+
# NOTHING TO DO
|
15
|
+
|
16
|
+
product / product.attribute.value / active (boolean) : NEW hasdefault: default
|
17
|
+
# DONE: added in pre-migration
|
18
|
+
|
19
|
+
product / product.category / message_follower_ids (one2many): NEW relation: mail.followers
|
20
|
+
product / product.category / message_ids (one2many) : NEW relation: mail.message
|
21
|
+
product / product.combo / combo_item_ids (one2many) : NEW relation: product.combo.item
|
22
|
+
product / product.combo / company_id (many2one) : NEW relation: res.company
|
23
|
+
product / product.combo / name (char) : NEW required
|
24
|
+
product / product.combo / sequence (integer) : NEW hasdefault: default
|
25
|
+
product / product.combo.item / combo_id (many2one) : NEW relation: product.combo, required
|
26
|
+
product / product.combo.item / company_id (many2one) : NEW relation: res.company, isrelated: related, stored
|
27
|
+
product / product.combo.item / extra_price (float) : NEW hasdefault: default
|
28
|
+
product / product.combo.item / product_id (many2one) : NEW relation: product.product, required
|
29
|
+
# NOTHING TO DO
|
30
|
+
|
31
|
+
product / product.document / _order : _order is now 'sequence, name' ('name')
|
32
|
+
# DONE: see product.document#sequence below
|
33
|
+
|
34
|
+
product / product.document / sequence (integer) : NEW hasdefault: default
|
35
|
+
# DONE: post-migration: create sequence matching name
|
36
|
+
|
37
|
+
product / product.pricelist / _order : _order is now 'sequence, id, name' ('sequence asc, id asc')
|
38
|
+
# NOTHING TO DO: change doesn't actually affect ordering
|
39
|
+
|
40
|
+
product / product.pricelist / discount_policy (selection) : DEL required, selection_keys: ['with_discount', 'without_discount']
|
41
|
+
product / product.pricelist.item / display_applied_on (selection): NEW required, selection_keys: ['1_product', '2_product_category'], hasdefault: default
|
42
|
+
product / product.pricelist.item / price_markup (float) : NEW isfunction: function, stored
|
43
|
+
# DONE: added and filled in pre-migration
|
44
|
+
|
45
|
+
product / product.product / _order : _order is now 'is_favorite desc, default_code, name, id' ('priority desc, default_code, name, id')
|
46
|
+
# NOTHING TO DO: see product.template#is_favorite below
|
47
|
+
|
48
|
+
product / product.product / combo_ids (many2many) : previously in module point_of_sale
|
49
|
+
# DONE: see product.combo above
|
50
|
+
|
51
|
+
product / product.product / service_tracking (selection) : previously in module sale_project
|
52
|
+
# NOTHING TO DO
|
53
|
+
|
54
|
+
product / product.product / standard_price (float) : needs conversion to v18-style company dependent
|
55
|
+
# DONE: post-migration
|
56
|
+
|
57
|
+
product / product.product / type (selection) : now required
|
58
|
+
# NOTHING TO DO: had a default in previous version already
|
59
|
+
|
60
|
+
product / product.tag / _order : _order is now 'sequence, id' ('id')
|
61
|
+
product / product.tag / sequence (integer) : NEW hasdefault: default
|
62
|
+
product / product.template / _order : _order is now 'is_favorite desc, name' ('priority desc, name')
|
63
|
+
# NOTHING TO DO: ordering stays the same
|
64
|
+
|
65
|
+
product / product.template / combo_ids (many2many) : previously in module point_of_sale
|
66
|
+
# NOTHING TO DO: see product.combo above
|
67
|
+
|
68
|
+
product / product.template / detailed_type (selection) : DEL required, selection_keys: ['consu', 'service']
|
69
|
+
# NOTHING TO DO, might need followup in subsequent addons
|
70
|
+
|
71
|
+
product / product.template / is_favorite (boolean) : NEW
|
72
|
+
product / product.template / priority (selection) : DEL selection_keys: ['0', '1']
|
73
|
+
# DONE: set is_favorite flag based on priority
|
74
|
+
|
75
|
+
product / product.template / service_tracking (selection) : previously in module sale_project
|
76
|
+
product / product.template / type (selection) : now required
|
77
|
+
product / product.template / type (selection) : selection_keys is now '['combo', 'consu', 'service']' ('['consu', 'service']')
|
78
|
+
# NOTHING TO DO
|
79
|
+
|
80
|
+
product / res.partner / specific_property_product_pricelist (many2one): NEW relation: product.pricelist
|
81
|
+
# DONE: post-migration: convert from v17 property res.partner#property_product_pricelist
|
82
|
+
|
83
|
+
---XML records in module 'product'---
|
84
|
+
NEW ir.actions.act_window: product.product_combo_action
|
85
|
+
NEW ir.model.access: product.access_product_combo_item_manager
|
86
|
+
NEW ir.model.access: product.access_product_combo_item_user
|
87
|
+
NEW ir.model.access: product.access_product_combo_manager
|
88
|
+
NEW ir.model.access: product.access_product_combo_user
|
89
|
+
NEW ir.model.access: product.access_update_product_attribute_value_manager
|
90
|
+
DEL ir.model.constraint: product.constraint_product_attribute_value_value_company_uniq
|
91
|
+
NEW ir.rule: product.product_combo_comp_rule (noupdate)
|
92
|
+
NEW ir.ui.view: product.product_attribute_search
|
93
|
+
NEW ir.ui.view: product.product_combo_view_form
|
94
|
+
NEW ir.ui.view: product.product_combo_view_tree
|
95
|
+
NEW ir.ui.view: product.product_packaging_search_view
|
96
|
+
NEW ir.ui.view: product.product_product_view_form_normalized
|
97
|
+
NEW ir.ui.view: product.product_template_attribute_line_view_tree
|
98
|
+
NEW ir.ui.view: product.update_product_attribute_value_form
|
99
|
+
NEW res.groups: product.group_product_manager
|
100
|
+
# NOTHING TO DO
|
101
|
+
|
102
|
+
DEL res.groups: product.group_discount_per_so_line [renamed to sale module]
|
103
|
+
# DONE: pre-migration: moved xmlid to sale
|
104
|
+
|
105
|
+
DEL res.groups: product.group_sale_pricelist
|
106
|
+
# NOTHING TO DO
|
@@ -0,0 +1,15 @@
|
|
1
|
+
env = locals().get("env")
|
2
|
+
# set specific pricelist
|
3
|
+
pricelist_main = env["product.pricelist"].create({"name": "Pricelist for main company"})
|
4
|
+
company = env["res.company"].create({"name": "Product migration test company"})
|
5
|
+
pricelist = (
|
6
|
+
env["product.pricelist"]
|
7
|
+
.with_company(company)
|
8
|
+
.create({"name": "Pricelist for demo company"})
|
9
|
+
)
|
10
|
+
partner = env.ref("base.user_demo").partner_id
|
11
|
+
|
12
|
+
partner.property_product_pricelist = pricelist_main
|
13
|
+
partner.with_company(company).property_product_pricelist = pricelist
|
14
|
+
|
15
|
+
env.cr.commit()
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from odoo.tests import TransactionCase
|
2
|
+
|
3
|
+
from odoo.addons.openupgrade_framework import openupgrade_test
|
4
|
+
|
5
|
+
|
6
|
+
@openupgrade_test
|
7
|
+
class TestProductMigration(TransactionCase):
|
8
|
+
def test_pricelist(self):
|
9
|
+
partner = self.env.ref("base.user_demo").partner_id
|
10
|
+
company = self.env["res.company"].search(
|
11
|
+
[
|
12
|
+
("name", "=", "Product migration test company"),
|
13
|
+
]
|
14
|
+
)
|
15
|
+
pricelist_main = self.env["product.pricelist"].search(
|
16
|
+
[
|
17
|
+
("name", "=", "Pricelist for main company"),
|
18
|
+
]
|
19
|
+
)
|
20
|
+
pricelist = self.env["product.pricelist"].search(
|
21
|
+
[
|
22
|
+
("name", "=", "Pricelist for demo company"),
|
23
|
+
]
|
24
|
+
)
|
25
|
+
self.assertTrue(company)
|
26
|
+
self.assertTrue(pricelist)
|
27
|
+
self.assertEqual(partner.property_product_pricelist, pricelist_main)
|
28
|
+
self.assertEqual(
|
29
|
+
partner.with_company(company).property_product_pricelist, pricelist
|
30
|
+
)
|
@@ -366,7 +366,12 @@ odoo/addons/openupgrade_scripts/scripts/pos_sms/18.0.1.0/upgrade_analysis.txt,sh
|
|
366
366
|
odoo/addons/openupgrade_scripts/scripts/pos_stripe/18.0.1.0/upgrade_analysis.txt,sha256=msYJoACfH4fpPoraAn3Z6NoclsSl2D3-B1v-CkNcCMM,153
|
367
367
|
odoo/addons/openupgrade_scripts/scripts/pos_viva_wallet/18.0.1.0/upgrade_analysis.txt,sha256=papgWPA_nb2FLlo9OXYamidxXTcJ8DatToyQk_SW4Kk,168
|
368
368
|
odoo/addons/openupgrade_scripts/scripts/privacy_lookup/18.0.1.0/upgrade_analysis.txt,sha256=l6bZO4RUtpRzJYYglTiPCXBa2Lni5Tl4AqAHkL0qU6g,165
|
369
|
+
odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/post-migration.py,sha256=Klh8oJuDsuRYr63pzr8KgP0ixM9ZnBceWMqf8rvMwzA,2151
|
370
|
+
odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/pre-migration.py,sha256=rhHrHEAjZp55e8ee1vouAxY7l7jGIkKNkHfYSZWj-wc,2083
|
369
371
|
odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/upgrade_analysis.txt,sha256=5l2YuhvG6tYU8P-n1ghdnQBYxoSDUs2tTWSoQC98pzU,6008
|
372
|
+
odoo/addons/openupgrade_scripts/scripts/product/18.0.1.2/upgrade_analysis_work.txt,sha256=smdswndL9a51eAYarCUprjJp6vrZk2NRvPJM-feBZpk,6215
|
373
|
+
odoo/addons/openupgrade_scripts/scripts/product/tests/data.py,sha256=chj9tmKaD5nwnkRWeC0NvjMDpeOSjQySIjNWsLh2Lks,530
|
374
|
+
odoo/addons/openupgrade_scripts/scripts/product/tests/test_migration.py,sha256=O0n79F4V3fyd5HeIDqpaC5BfNHLD-ndUWNmYT3vQdL0,991
|
370
375
|
odoo/addons/openupgrade_scripts/scripts/product_email_template/18.0.1.0/upgrade_analysis.txt,sha256=Dx6pySBrbJMWmtd4YMb2kJvvwUS13cMjXP0r6zLfLWk,189
|
371
376
|
odoo/addons/openupgrade_scripts/scripts/product_expiry/18.0.1.0/upgrade_analysis.txt,sha256=ZPVH0BUpLBjzNsh8SK1efIorJrGz5UG6aTMjsqvC-Sc,186
|
372
377
|
odoo/addons/openupgrade_scripts/scripts/product_images/18.0.1.0/upgrade_analysis.txt,sha256=ZFdJzO3tOMvoa1XV86Kzqw5uqUSHhXmQjlN8ebFkbS8,165
|
@@ -503,7 +508,7 @@ odoo/addons/openupgrade_scripts/scripts/website_slides_survey/18.0.1.0/upgrade_a
|
|
503
508
|
odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
|
504
509
|
odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
|
505
510
|
odoo/addons/openupgrade_scripts/static/description/index.html,sha256=Jc0qAThlH5WnoSq6vPamjC8WyMkdo_9zkhDuU1qW1VI,12722
|
506
|
-
odoo_addon_openupgrade_scripts-18.0.1.0.0.
|
507
|
-
odoo_addon_openupgrade_scripts-18.0.1.0.0.
|
508
|
-
odoo_addon_openupgrade_scripts-18.0.1.0.0.
|
509
|
-
odoo_addon_openupgrade_scripts-18.0.1.0.0.
|
511
|
+
odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info/METADATA,sha256=78R-0kwUhJGzn7ZpzRFJHsX19VuTERBwFamfYJEi7O0,3774
|
512
|
+
odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info/WHEEL,sha256=9fEMia4zL7ZuZbnCOrcYogUhmn4XFIVaJ8G4YGI31xc,81
|
513
|
+
odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
|
514
|
+
odoo_addon_openupgrade_scripts-18.0.1.0.0.56.dist-info/RECORD,,
|
File without changes
|