From d8c6449f3a173212889658c40f34a8bd26630c73 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 25 Dec 2017 11:26:40 +0530 Subject: [PATCH] [Fix] Bom raw materials not in order in the stock entry (#12149) --- erpnext/manufacturing/doctype/bom/bom.py | 1 + erpnext/stock/doctype/stock_entry/stock_entry.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index b140bf591e..4b67d016c6 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -519,6 +519,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite # Did not use qty_consumed_per_unit in the query, as it leads to rounding loss query = """select bom_item.item_code, + bom_item.idx, item.item_name, sum(bom_item.stock_qty/ifnull(bom.quantity, 1)) * %(qty)s as qty, item.description, diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index a0103eda7e..6a0853c2e1 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -775,6 +775,9 @@ class StockEntry(StockController): se_child.expense_account = item_dict[d].get("expense_account") or expense_account se_child.cost_center = item_dict[d].get("cost_center") or cost_center + if item_dict[d].get("idx"): + se_child.idx = item_dict[d].get("idx") + if se_child.s_warehouse==None: se_child.s_warehouse = self.from_warehouse if se_child.t_warehouse==None: