Skip to content

Commit

Permalink
[IMP]product_configurator_mrp: When configurator creates a new BOM, i…
Browse files Browse the repository at this point in the history
…t should copy over the operations from the master BOM
  • Loading branch information
vimalpatelserpentcs committed Dec 3, 2021
1 parent fd1858f commit ea1815f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion product_configurator_mrp/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Product Configurator Manufacturing",
"version": "14.0.1.2.0",
"version": "14.0.1.2.1",
"category": "Manufacturing",
"summary": "BOM Support for configurable products",
"author": "Pledra, Odoo Community Association (OCA)",
Expand Down
3 changes: 3 additions & 0 deletions product_configurator_mrp/models/product_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def create_get_bom(self, variant, product_tmpl_id=None, values=None):
values = self.get_vals_to_write(values=values, model="mrp.bom")
values.update(bom_values)
mrp_bom_id = mrpBom.create(values)
if mrp_bom_id and parent_bom:
for operation_line in parent_bom.operation_ids:
operation_line.copy(default={"bom_id": mrp_bom_id.id})
return mrp_bom_id
return False

Expand Down
12 changes: 11 additions & 1 deletion product_configurator_mrp/tests/test_mrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ def setUp(self):
self.mrpBomConfig = self.env["mrp.bom.line.configuration"]
self.mrpBom = self.env["mrp.bom"]
self.mrpBomLine = self.env["mrp.bom.line"]
self.mrpRoutingWorkcenter = self.env["mrp.routing.workcenter"]
self.productProduct = self.env["product.product"]
self.productTemplate = self.env["product.template"]
self.mrpProduction = self.env["mrp.production"]
self.product_id = self.env.ref("product.product_product_3")
self.workcenter_id = self.env.ref("mrp.mrp_workcenter_3")

# create bom
self.bom_id = self.mrpBom.create(
Expand All @@ -37,6 +39,14 @@ def setUp(self):
"product_qty": 1.00,
}
)
# create BOM operations line
self.mrpRoutingWorkcenter.create(
{
"bom_id": self.bom_id.id,
"name": "Operation 1",
"workcenter_id": self.workcenter_id.id,
}
)

def test_00_skip_bom_line(self):
checkVal = self.mrpBomLine._skip_bom_line(product=self.product_id)
Expand Down Expand Up @@ -109,7 +119,7 @@ def test_01_action_config_start(self):
context
)
self._configure_product_nxt_step()
# self.assertEqual(

# vals['res_id'],
# mrpProduction.product_id.id,
# 'Not Equal'
Expand Down

0 comments on commit ea1815f

Please sign in to comment.