From 4dc5f0efaf0cbcd404672e56f04bc17f76a35664 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 22 Nov 2017 15:21:47 +0530 Subject: [PATCH] [Fix] Item details not fetching if item has no default bom (#11688) --- erpnext/controllers/buying_controller.py | 2 +- erpnext/stock/get_item_details.py | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index d3010818e5..e5987359d0 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -171,7 +171,7 @@ class BuyingController(StockController): for item in self.get("items"): if self.doctype in ["Purchase Receipt", "Purchase Invoice"]: item.rm_supp_cost = 0.0 - if item.item_code in self.sub_contracted_items: + if item.bom and item.item_code in self.sub_contracted_items: self.update_raw_materials_supplied(item, raw_material_table) if [item.item_code, item.name] not in parent_items: diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 539e8a5667..9ec5d195be 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -96,16 +96,6 @@ def get_item_details(args): return out - # print(frappe._dict({ - # 'has_serial_no' : out.has_serial_no, - # 'has_batch_no' : out.has_batch_no - # })) - - # return frappe._dict({ - # 'has_serial_no' : out.has_serial_no, - # 'has_batch_no' : out.has_batch_no - # }) - def process_args(args): if isinstance(args, basestring): args = json.loads(args) @@ -532,8 +522,6 @@ def get_default_bom(item_code=None): bom = frappe.db.get_value("BOM", {"docstatus": 1, "is_default": 1, "is_active": 1, "item": item_code}) if bom: return bom - else: - frappe.throw(_("No default BOM exists for Item {0}").format(item_code)) def get_valuation_rate(item_code, warehouse=None): item = frappe.get_doc("Item", item_code)