Skip to content

Commit d5906e0

Browse files
committed
Merge PR OCA#1963 into 16.0
Signed-off-by rousseldenis
2 parents 079d59b + c96848f commit d5906e0

File tree

6 files changed

+59
-28
lines changed

6 files changed

+59
-28
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from . import models
2-
from .hooks import pre_init_hook

product_packaging_level/__manifest__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"development_status": "Beta",
88
"category": "Product",
99
"summary": "This module binds a product packaging to a packaging level",
10-
"author": "Camptocamp, " "Odoo Community Association (OCA)",
10+
"author": "Camptocamp, Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/product-attribute",
1212
"license": "LGPL-3",
1313
"depends": ["product", "stock"],
@@ -21,5 +21,4 @@
2121
"installable": True,
2222
"auto_install": False,
2323
"external_dependencies": {"python": ["openupgradelib"]},
24-
"pre_init_hook": "pre_init_hook",
2524
}

product_packaging_level/hooks.py

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version='1.0' encoding='utf-8' ?>
2+
<odoo>
3+
<record id="product_packaging_level_default" model="product.packaging.level">
4+
<field name="name">Default Level</field>
5+
</record>
6+
</odoo>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
openupgrade.load_data(
10+
env, "product_packaging_level", "16.0.1.0.0/noupdate_changes.xml"
11+
)
12+
openupgrade.delete_record_translations(
13+
env.cr,
14+
"product_packaging_level",
15+
["product_packaging_level_default"],
16+
["name"],
17+
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2022 ACSONE SA/NV
2+
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
3+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
if not openupgrade.table_exists(env.cr, "product_packaging_type"):
10+
return
11+
# Former version of the module is present
12+
openupgrade.rename_models(
13+
env.cr, [("product.packaging.type", "product.packaging.level")]
14+
)
15+
openupgrade.rename_tables(
16+
env.cr, [("product_packaging_type", "product_packaging_level")]
17+
)
18+
fields = [
19+
(
20+
"product.packaging",
21+
"product_packaging",
22+
"packaging_type_id",
23+
"packaging_level_id",
24+
)
25+
]
26+
openupgrade.rename_fields(env, fields, no_deep=True)
27+
openupgrade.rename_xmlids(
28+
env.cr,
29+
[
30+
(
31+
"product_packaging_level.product_packaging_type_default",
32+
"product_packaging_level.product_packaging_level_default",
33+
)
34+
],
35+
)

0 commit comments

Comments
 (0)