Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelTorrecillas committed Jan 17, 2025
1 parent ef98cca commit 1fb0ee2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packaging_uom/tests/test_product_packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def setUpClass(cls):
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.packaging_obj = cls.env["product.packaging"]
cls.uom_obj = cls.env["uom.uom"]
cls.category_obj = cls.env["uom.category"]
cls.uom_unit = cls.env.ref("uom.product_uom_unit")
cls.uom_dozen = cls.env.ref("uom.product_uom_dozen")
cls.product_dozen = cls.env["product.product"].create(
Expand All @@ -19,6 +20,11 @@ def setUpClass(cls):
cls.product_unit = cls.env["product.product"].create(
{"name": "PRODUCT UNIT", "uom_id": cls.uom_unit.id}
)
cls.categ_kgm_uom = cls.env.ref("uom.product_uom_categ_kgm")
cls.categ_unit_uom = cls.env.ref("uom.product_uom_categ_unit")
cls.product_kgm = cls.env["product.product"].create(
{"name": "PRODUCT KGM", "uom_id": cls.categ_kgm_uom.id}
)

def test_compute_quantity_by_package(self):
"""Create a packagings with uom product_uom_dozen on
Expand Down Expand Up @@ -142,6 +148,26 @@ def test_compute_quantity_by_package(self):
)
self.assertEqual(1, len(uom_524))

def test_onchange_product_id(self):
"""
Create a packagings with uom product_dozen
* product_kgm (uom is categ_kgm_uom)
* product_unit (uom is product_uom_kgm)
Result should be :
* uom_categ_domain_id -> categ_unit_uom
Update product_packaging_unit to set this product_unit
Result should be :
* uom_categ_domain_id -> categ_unit_uom
"""

product_packaging = self.packaging_obj.create(
{"name": "PACKAGING TEST", "product_id": self.product_kgm.id}
)
self.assertEqual(self.categ_unit_uom, product_packaging.uom_categ_domain_id)
product_packaging.product_id = self.product_unit
self.assertEqual(self.categ_unit_uom, product_packaging.uom_categ_domain_id)


# def test_packaging_qty_zero(self):
# """
# To avoid changing standard behaviour, we affect the default
Expand Down

0 comments on commit 1fb0ee2

Please sign in to comment.