Merge pull request #14088 from manassolanki/item-fixes

more fixes for the item defaults
This commit is contained in:
Manas Solanki 2018-05-16 17:16:25 +05:30 committed by GitHub
commit efae732370
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,10 +343,10 @@ def check_active_sales_items(obj):
item = frappe.db.sql("""select i.docstatus, id.income_account item = frappe.db.sql("""select i.docstatus, id.income_account
from `tabItem` i, `tabItem Default` id from `tabItem` i, `tabItem Default` id
where i.name=%s and id.parent=i.name and id.company=%s""", 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 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) doc = frappe.get_doc("Item", d.item_code)
for default in doc.item_defaults: for default in doc.item_defaults:
if default.company == obj.company: if default.company == obj.company: