Skip to content

Commit

Permalink
fixup! maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
HviorForgeFlow committed Mar 25, 2019
1 parent d7cda88 commit 592c2e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mrp_bom_current_stock/tests/test_mrp_bom_current_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def setUpClass(cls):
cls.bom_line_obj = cls.env['mrp.bom.line']

cls.uom_dozen = cls.env.ref('product.product_uom_dozen')
cls.uom_meter = cls.env.ref('product.product_uom_meter')

# Create products:
cls.product_top = cls.product_obj.create({
Expand Down Expand Up @@ -78,12 +79,13 @@ def setUpClass(cls):
'product_id': cls.component_1.id,
'bom_id': cls.bom_sub_1.id,
'product_qty': 2.0,
'product_uom': cls.uom_meter
})
cls.line_sub_1_2 = cls.bom_line_obj.create({
'product_id': cls.component_2.id,
'bom_id': cls.bom_sub_1.id,
'product_qty': 5.0,
'product_uom': cls.env.ref('product.product_uom_dozen')
'product_uom': cls.uom_dozen
})

cls.bom_sub_2 = cls.bom_obj.create({
Expand Down
10 changes: 9 additions & 1 deletion mrp_bom_current_stock/wizard/bom_route_current_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@ def _create_lines(bom, location, level=0, factor=1):
line_obj.create(vals)
line_boms = line.product_id.bom_ids
if line_boms:
new_factor = factor * line.product_qty / bom.product_qty
if line.product_uom_id.category_id == \
bom.product_uom_id.category_id:
line_qty = line.product_uom_id._compute_quantity(
line.product_qty,
bom.product_uom_id,
)
else:
line_qty = line.product_qty
new_factor = factor * line_qty / bom.product_qty
for line_bom in line_boms:
_create_lines(line_bom, location, level, new_factor)

Expand Down

0 comments on commit 592c2e8

Please sign in to comment.