Skip to content

Commit

Permalink
[IMP] Improved code for scaffolding bom
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikul-OSI committed Aug 6, 2024
1 parent 01e170b commit 688b3c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions product_configurator_mrp_component/models/mrp_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ def _compute_available_config_components(self):
prod_vals = prod.mapped(
"attribute_line_ids.value_ids"
).filtered(
lambda m: m.attribute_id == attribute_line.attribute_id
lambda m, attribute_line: m.attribute_id
== attribute_line.attribute_id
)
bom_tmpl_values = bom.product_tmpl_id.mapped(
"attribute_line_ids.value_ids"
).filtered(
lambda m: m.attribute_id == attribute_line.attribute_id
lambda m, attribute_line: m.attribute_id
== attribute_line.attribute_id
)
# If bom prod has all vals that conf comp has then add it
if all(att_val in bom_tmpl_values for att_val in prod_vals):
Expand Down
10 changes: 10 additions & 0 deletions product_configurator_mrp_component/models/product_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ def create_get_bom(self, variant, product_tmpl_id=None, values=None):
[
("product_tmpl_id", "=", product_tmpl_id.id),
("product_id", "=", False),
("scaffolding_bom", "=", True),
],
order="sequence asc",
limit=1,
)
if not master_bom:
master_bom = self.env["mrp.bom"].search(
[
("product_tmpl_id", "=", product_tmpl_id.id),
("product_id", "=", False),
],
order="sequence asc",
limit=1,
)
vals = False
wizard_values = variant.product_template_attribute_value_ids.mapped(
"product_attribute_value_id"
Expand Down

0 comments on commit 688b3c6

Please sign in to comment.