Merge branch 'develop' into fix-payroll-UI
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 3e013f5..e2f99d6 100755
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -451,6 +451,10 @@
def add_customer(data):
+ customer = data.get('full_name') or data.get('customer')
+ if frappe.db.exists("Customer", customer.strip()):
+ return customer.strip()
+
customer_doc = frappe.new_doc('Customer')
customer_doc.customer_name = data.get('full_name') or data.get('customer')
customer_doc.customer_pos_id = data.get('customer_pos_id')
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index e41c74c..8f1dfbc 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -730,7 +730,6 @@
parent_fieldname = 'parent_' + doctype.lower().replace(' ', '_')
fields = [
'name as value',
- 'root_type',
'is_group as expandable'
]
filters = [['docstatus', '<', 2]]
@@ -738,11 +737,11 @@
filters.append(['ifnull(`{0}`,"")'.format(parent_fieldname), '=', '' if is_root else parent])
if is_root:
- fields += ['report_type', 'account_currency'] if doctype == 'Account' else []
+ fields += ['root_type', 'report_type', 'account_currency'] if doctype == 'Account' else []
filters.append(['company', '=', company])
else:
- fields += ['account_currency'] if doctype == 'Account' else []
+ fields += ['root_type', 'account_currency'] if doctype == 'Account' else []
fields += [parent_fieldname + ' as parent']
acc = frappe.get_list(doctype, fields=fields, filters=filters)