removed validation for root node in territory, codacy recommended changed
This commit is contained in:
parent
b59f2780eb
commit
7cbc902d90
@ -39,6 +39,6 @@ frappe.query_reports["Customer Acquisition and Loyalty"] = {
|
||||
if (data && data.bold) {
|
||||
value = value.bold();
|
||||
}
|
||||
return value
|
||||
return value;
|
||||
}
|
||||
}
|
@ -162,7 +162,7 @@ def get_data_by_territory(filters, common_columns):
|
||||
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 @@ def update_groups(node, data, root_node, territory_dict):
|
||||
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'
|
||||
|
@ -12,8 +12,6 @@ class Territory(NestedSet):
|
||||
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user