removed validation for root node in territory, codacy recommended changed
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
index c24d2e2..d93ffb7 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.js
@@ -39,6 +39,6 @@
if (data && data.bold) {
value = value.bold();
}
- return value
+ return value;
}
}
\ No newline at end of file
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
index d8cc763..0121a82 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
@@ -162,7 +162,7 @@
return columns, data, None, None, None, 1
def update_groups(node, data, root_node, territory_dict):
- ''' Adds values of child territories to parent node except root '''
+ ''' Adds values of child territories to parent node except root. '''
parent_node = territory_dict[node]['parent']
if parent_node != root_node and parent_node:
node_data = [x for x in data if x['territory'] == node][0]
@@ -175,7 +175,7 @@
return data
def get_customer_stats(filters, tree_view=False):
- ''' Calculates number of new and repeated customers '''
+ ''' Calculates number of new and repeated customers. '''
company_condition = ''
if filters.get('company'):
company_condition = ' and company=%(company)s'
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 4f2ab70..808b538 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -12,8 +12,6 @@
nsm_parent_field = 'parent_territory'
def validate(self):
- if frappe.db.sql("SELECT COUNT(name) FROM `tabTerritory` WHERE parent IS NULL")[0][0] > 1:
- frappe.throw('Only one Root Territory is allowed, please select a Parent Territory!')
for d in self.get('targets') or []:
if not flt(d.target_qty) and not flt(d.target_amount):