mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[10.0][PYLINT] packaging_uom, sale_packaging, purchase_packaging
This commit is contained in:
committed by
Thomas Binsfeld
parent
df4e9623a8
commit
1bf4ab0877
@@ -65,4 +65,5 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
|
||||
|
||||
0
packaging_uom/__init__.py
Executable file → Normal file
0
packaging_uom/__init__.py
Executable file → Normal file
12
packaging_uom/__manifest__.py
Executable file → Normal file
12
packaging_uom/__manifest__.py
Executable file → Normal file
@@ -3,16 +3,18 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Packaging UOM",
|
||||
"version": "10.0.1.0.0",
|
||||
"version": "10.0.1.0.1",
|
||||
"author": 'ACSONE SA/NV, '
|
||||
'Odoo Community Association (OCA)',
|
||||
"category": "Warehouse",
|
||||
"website": "http://www.acsone.eu",
|
||||
'summary': "Use uom in package",
|
||||
"depends": ["product",
|
||||
],
|
||||
"data": ["views/product_packaging_views.xml",
|
||||
],
|
||||
"depends": [
|
||||
"product",
|
||||
],
|
||||
"data": [
|
||||
"views/product_packaging_views.xml",
|
||||
],
|
||||
"license": "AGPL-3",
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
0
packaging_uom/models/__init__.py
Executable file → Normal file
0
packaging_uom/models/__init__.py
Executable file → Normal file
@@ -11,13 +11,14 @@ class TestProductPackaging(common.TransactionCase):
|
||||
super(TestProductPackaging, self).setUp()
|
||||
self.uom_unit = self.env.ref('product.product_uom_unit')
|
||||
self.uom_dozen = self.env.ref('product.product_uom_dozen')
|
||||
self.product_tmpl_dozen = self.env['product.template'].create(
|
||||
{'name': 'PRODUCT DOZEN',
|
||||
'uom_id': self.uom_dozen.id})
|
||||
self.product_tmpl_unit = self.env['product.template'].create(
|
||||
{'name': 'PRODUCT UNIT',
|
||||
'uom_id': self.uom_unit.id}
|
||||
)
|
||||
self.product_tmpl_dozen = self.env['product.template'].create({
|
||||
'name': 'PRODUCT DOZEN',
|
||||
'uom_id': self.uom_dozen.id,
|
||||
})
|
||||
self.product_tmpl_unit = self.env['product.template'].create({
|
||||
'name': 'PRODUCT UNIT',
|
||||
'uom_id': self.uom_unit.id,
|
||||
})
|
||||
|
||||
def test_compute_quantity_by_package(self):
|
||||
""" Create a packagings with uom product_uom_dozen on
|
||||
@@ -43,38 +44,40 @@ class TestProductPackaging(common.TransactionCase):
|
||||
"""
|
||||
|
||||
packaging_obj = self.env['product.packaging']
|
||||
product_packaging_dozen = packaging_obj.create(
|
||||
{'name': 'PACKAGING 1',
|
||||
'product_tmpl_id': self.product_tmpl_dozen.id,
|
||||
'uom_id': self.uom_dozen.id})
|
||||
product_packaging_dozen = packaging_obj.create({
|
||||
'name': 'PACKAGING 1',
|
||||
'product_tmpl_id': self.product_tmpl_dozen.id,
|
||||
'uom_id': self.uom_dozen.id,
|
||||
})
|
||||
self.assertAlmostEqual(product_packaging_dozen.qty, 1)
|
||||
product_packaging_unit = packaging_obj.with_context(
|
||||
get_uom_categ_from_uom=self.uom_dozen.category_id.id).create(
|
||||
{'name': 'PACKAGING 2',
|
||||
'product_tmpl_id': self.product_tmpl_unit.id,
|
||||
'uom_id': self.uom_dozen.id})
|
||||
get_uom_categ_from_uom=self.uom_dozen.category_id.id).create({
|
||||
'name': 'PACKAGING 2',
|
||||
'product_tmpl_id': self.product_tmpl_unit.id,
|
||||
'uom_id': self.uom_dozen.id,
|
||||
})
|
||||
self.assertAlmostEqual(product_packaging_unit.qty, 12)
|
||||
self.assertEqual(
|
||||
self.uom_dozen.category_id,
|
||||
product_packaging_unit.uom_categ_domain_id,
|
||||
'The UOM domain is not well set'
|
||||
)
|
||||
product_uom_24 = self.env['product.uom'].create(
|
||||
{'category_id': self.env.ref('product.product_uom_categ_unit').id,
|
||||
'name': 'Double Dozens',
|
||||
'factor_inv': 24,
|
||||
'uom_type': 'bigger'
|
||||
})
|
||||
product_uom_24 = self.env['product.uom'].create({
|
||||
'category_id': self.env.ref('product.product_uom_categ_unit').id,
|
||||
'name': 'Double Dozens',
|
||||
'factor_inv': 24,
|
||||
'uom_type': 'bigger',
|
||||
})
|
||||
self.product_tmpl_dozen.uom_id = product_uom_24
|
||||
self.assertAlmostEqual(product_packaging_dozen.qty, 0.5)
|
||||
product_packaging_unit.uom_id = product_uom_24
|
||||
self.assertAlmostEqual(product_packaging_unit.qty, 24)
|
||||
product_uom_6 = self.env['product.uom'].create(
|
||||
{'category_id': self.env.ref('product.product_uom_categ_unit').id,
|
||||
'name': 'Demi Dozens',
|
||||
'factor_inv': 6,
|
||||
'uom_type': 'bigger'
|
||||
})
|
||||
product_uom_6 = self.env['product.uom'].create({
|
||||
'category_id': self.env.ref('product.product_uom_categ_unit').id,
|
||||
'name': 'Demi Dozens',
|
||||
'factor_inv': 6,
|
||||
'uom_type': 'bigger',
|
||||
})
|
||||
self.product_tmpl_dozen.uom_id = product_uom_6
|
||||
self.assertAlmostEqual(product_packaging_dozen.qty, 2)
|
||||
product_packaging_unit.uom_id = product_uom_6
|
||||
|
||||
Reference in New Issue
Block a user