Skip to content

Commit 2fc1535

Browse files
committed
[MIG] product_packaging_level_salable: Migration to 18.0
1 parent 8c465b6 commit 2fc1535

File tree

9 files changed

+25
-23
lines changed

9 files changed

+25
-23
lines changed

product_packaging_level_salable/README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ Contributors
7373
------------
7474

7575
- Duong (Tran Quoc) <duongtq@trobz.com>
76+
- Tris Doan <tridm@trobz.com>
7677

7778
Other credits
7879
-------------
7980

80-
The development of this module has been financially supported by:
81+
The development and migration of this module has been financially
82+
supported by:
8183

8284
- Camptocamp
8385

product_packaging_level_salable/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Product Packaging level salable",
55
"summary": "",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"development_status": "Alpha",
88
"category": "Product",
99
"website": "https://github.com/OCA/product-attribute",

product_packaging_level_salable/models/sale_order_line.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
33

4-
from odoo import _, api, models
4+
from odoo import api, models
55
from odoo.exceptions import ValidationError
66

77

@@ -17,23 +17,21 @@ def _check_product_packaging_can_be_sold(self):
1717
for line in self:
1818
if line._can_be_sold_error_condition():
1919
raise ValidationError(
20-
_(
20+
self.env._(
2121
"Packaging %(packaging)s on product %(product)s must be"
22-
" set as 'Sales' in order to be used on a sale order."
22+
" set as 'Sales' in order to be used on a sale order.",
23+
packaging=line.product_packaging_id.name,
24+
product=line.product_id.name,
2325
)
24-
% {
25-
"packaging": line.product_packaging_id.name,
26-
"product": line.product_id.name,
27-
}
2826
)
2927

3028
@api.onchange("product_packaging_id")
3129
def _onchange_product_packaging_id(self):
3230
if self._can_be_sold_error_condition():
3331
return {
3432
"warning": {
35-
"title": _("Warning"),
36-
"message": _(
33+
"title": self.env._("Warning"),
34+
"message": self.env._(
3735
"This product packaging must be set as 'Sales' in"
3836
" order to be used on a sale order."
3937
),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
- Duong (Tran Quoc) \<<duongtq@trobz.com>\>
2+
- Tris Doan \<<tridm@trobz.com>\>

product_packaging_level_salable/readme/CREDITS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The development of this module has been financially supported by:
1+
The development and migration of this module has been financially supported by:
22

33
- Camptocamp
44

product_packaging_level_salable/static/description/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,13 @@ <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
422422
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
423423
<ul class="simple">
424424
<li>Duong (Tran Quoc) &lt;<a class="reference external" href="mailto:duongtq&#64;trobz.com">duongtq&#64;trobz.com</a>&gt;</li>
425+
<li>Tris Doan &lt;<a class="reference external" href="mailto:tridm&#64;trobz.com">tridm&#64;trobz.com</a>&gt;</li>
425426
</ul>
426427
</div>
427428
<div class="section" id="other-credits">
428429
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
429-
<p>The development of this module has been financially supported by:</p>
430+
<p>The development and migration of this module has been financially
431+
supported by:</p>
430432
<ul class="simple">
431433
<li>Camptocamp</li>
432434
</ul>

product_packaging_level_salable/tests/common.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
# Copyright 2023 Camptocamp SA
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
33

4-
from odoo.tests.common import Form, TransactionCase
4+
from odoo.tests import Form, tagged
5+
6+
from odoo.addons.base.tests.common import BaseCommon
57

68
TU_PRODUCT_QTY = 20
79
PL_PRODUCT_QTY = TU_PRODUCT_QTY * 30
810

911

10-
class Common(TransactionCase):
11-
at_install = False
12-
post_install = True
13-
12+
@tagged("post_install", "-at_install")
13+
class Common(BaseCommon):
1414
@classmethod
1515
def setUpClass(cls):
1616
super().setUpClass()
17-
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
1817
cls.setUpClassPartner()
1918
cls.setUpClassProduct()
2019
cls.setUpClassPackagingLevel()

product_packaging_level_salable/tests/test_packaging_level_can_be_sold.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setUpClassSaleOrder(cls):
1616

1717
def test_packaging_level_can_be_sold(self):
1818
self.order_line.write({"product_packaging_id": self.packaging_tu.id})
19-
with self.assertRaises(ValidationError):
19+
with self.assertRaisesRegex(ValidationError):
2020
self.order_line.write(
2121
{"product_packaging_id": self.packaging_cannot_be_sold.id}
2222
)
@@ -29,7 +29,7 @@ def test_onchange_product_packaging_id(self):
2929
def test_product_packaging_can_be_sold(self):
3030
"""Check that a product.packaging can be independently set as can be sold."""
3131
exception_msg = (
32-
f"Packaging Test packaging cannot be sold on product {self.product.name} must be set "
32+
f"Test packaging cannot be sold on product {self.product.name} must be set "
3333
"as 'Sales' in order to be used on a sale order."
3434
)
3535
with self.assertRaisesRegex(ValidationError, exception_msg):

product_packaging_level_salable/views/product_packaging_level.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
</field>
1414
</record>
1515

16-
<record id="view_product_packaging_level_tree" model="ir.ui.view">
16+
<record id="view_product_packaging_level_list" model="ir.ui.view">
1717
<field name="model">product.packaging.level</field>
1818
<field
1919
name="inherit_id"
20-
ref="product_packaging_level.view_product_packaging_level_tree"
20+
ref="product_packaging_level.view_product_packaging_level_list"
2121
/>
2222
<field name="arch" type="xml">
2323
<field name="code" position="after">

0 commit comments

Comments
 (0)