[FIX] mrp: fix the uom conversion issue in bom kit
no need to make rounding during computing qty_available
STEPS (see the test):
- create product with uom dozens
- create product with uom units
- create bom kit to convert one to another
- set qty on hand to 1 for product dozens
- check qty for product units
opw-2849397
closes odoo/odoo#93035
X-original-commit: 83afc17890b9a7b41e21aa5db738b04a13680cd4
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -428,6 +428,37 @@ class TestBoM(TestMrpCommon):
|
||||
kit_product_qty, _ = (self.product_2 + self.product_3).mapped("qty_available") # With product_3 in the prefetch
|
||||
self.assertEqual(float_repr(float_round(kit_product_qty, precision_digits=precision.digits), precision_digits=precision.digits), '-384.00000')
|
||||
|
||||
def test_13_bom_kit_qty_multi_uom(self):
|
||||
uom_dozens = self.env.ref('uom.product_uom_dozen')
|
||||
uom_unit = self.env.ref('uom.product_uom_unit')
|
||||
product_unit = self.env['product.product'].create({
|
||||
'name': 'Test units',
|
||||
'type': 'product',
|
||||
'uom_id': uom_unit.id,
|
||||
})
|
||||
product_dozens = self.env['product.product'].create({
|
||||
'name': 'Test dozens',
|
||||
'type': 'product',
|
||||
'uom_id': uom_dozens.id,
|
||||
})
|
||||
|
||||
self.env['mrp.bom'].create({
|
||||
'product_tmpl_id': product_unit.product_tmpl_id.id,
|
||||
'product_uom_id': self.uom_unit.id,
|
||||
'product_qty': 1.0,
|
||||
'type': 'phantom',
|
||||
'bom_line_ids': [
|
||||
(0, 0, {
|
||||
'product_id': product_dozens.id,
|
||||
'product_qty': 1,
|
||||
'product_uom_id': uom_unit.id,
|
||||
})
|
||||
]
|
||||
})
|
||||
location = self.env.ref('stock.stock_location_stock')
|
||||
self.env['stock.quant']._update_available_quantity(product_dozens, location, 1.0)
|
||||
self.assertEqual(product_unit.qty_available, 12.0)
|
||||
|
||||
def test_20_bom_report(self):
|
||||
""" Simulate a crumble receipt with mrp and open the bom structure
|
||||
report and check that data insde are correct.
|
||||
|
||||
Reference in New Issue
Block a user