File tree Expand file tree Collapse file tree 9 files changed +25
-23
lines changed
product_packaging_level_salable Expand file tree Collapse file tree 9 files changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -73,11 +73,13 @@ Contributors
7373------------
7474
7575- Duong (Tran Quoc) <duongtq@trobz.com>
76+ - Tris Doan <tridm@trobz.com>
7677
7778Other 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
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 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
55from 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 ),
Original file line number Diff line number Diff line change 11- Duong (Tran Quoc) \< < duongtq@trobz.com > \>
2+ - Tris Doan \< < tridm@trobz.com > \>
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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) << a class ="reference external " href ="mailto:duongtq@trobz.com "> duongtq@trobz.com</ a > ></ li >
425+ < li > Tris Doan << a class ="reference external " href ="mailto:tridm@trobz.com "> tridm@trobz.com</ a > ></ 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 >
Original file line number Diff line number Diff line change 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
68TU_PRODUCT_QTY = 20
79PL_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 ()
Original file line number Diff line number Diff 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 ):
Original file line number Diff line number Diff line change 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" >
You can’t perform that action at this time.
0 commit comments