From e3bb1d0e3b63df6dc20dae3287e67ae06b5c37bd Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 16 May 2018 17:14:59 +0530 Subject: [PATCH] more fixes for the item defaults --- erpnext/controllers/selling_controller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 83e7916e84..a05b282877 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -343,10 +343,10 @@ def check_active_sales_items(obj): item = frappe.db.sql("""select i.docstatus, id.income_account from `tabItem` i, `tabItem Default` id where i.name=%s and id.parent=i.name and id.company=%s""", - (d.item_code,obj.company), as_dict=True)[0] + (d.item_code,obj.company), as_dict=True) income_account_set = False - if getattr(d, "income_account", None) and not item.income_account: + if getattr(d, "income_account", None) and item and not item[0].income_account: doc = frappe.get_doc("Item", d.item_code) for default in doc.item_defaults: if default.company == obj.company: