Skip to content

Commit

Permalink
Merge pull request #33 from 8848digital/23mr_from_bom
Browse files Browse the repository at this point in the history
fix: creation of mr fetch items from  bom
  • Loading branch information
aasif-patel authored Sep 25, 2024
2 parents 0db3fe8 + 6641bda commit 0632f26
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions erpnext/manufacturing/doctype/bom/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,8 +1122,26 @@ def get_bom_items_as_dict(
and bom.name = %(bom)s
and item.is_stock_item in (1, {is_stock_item})
{where_conditions}
group by item_code, stock_uom
order by idx"""
group by bom_item.item_code, bom_item.stock_uom,
bom_item.idx,
item.item_name,
item.image,
bom.project,
bom_item.rate,
item.stock_uom,
item.item_group,
item.allow_alternative_item,
item_default.default_warehouse,
item_default.expense_account,
item_default.buying_cost_center,
bom_item.source_warehouse,
bom_item.operation,
bom_item.include_item_in_manufacturing,
bom_item.description,
bom_item.rate,
bom_item.sourced_by_supplier,
bom_item_idx
order by bom_item.idx"""

is_stock_item = 0 if include_non_stock_items else 1
if cint(fetch_exploded):
Expand All @@ -1134,7 +1152,7 @@ def get_bom_items_as_dict(
qty_field="stock_qty",
select_columns=""", bom_item.source_warehouse, bom_item.operation,
bom_item.include_item_in_manufacturing, bom_item.description, bom_item.rate, bom_item.sourced_by_supplier,
(Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as idx""",
(Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as bom_item_idx""",
)

items = frappe.db.sql(
Expand Down

0 comments on commit 0632f26

Please sign in to comment.