From 24442af9aed8bd8dd74eb3be0156f2007a6525a5 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Fri, 3 May 2019 17:56:21 +0530 Subject: [PATCH] fix: use list comprehension --- erpnext/selling/doctype/customer/customer.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index fd3d260c07..365c2ed249 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -61,11 +61,7 @@ class Customer(TransactionBase): self.loyalty_program_tier = customer.loyalty_program_tier if self.sales_team: - allocated_percentage = 0 - for percentage in self.sales_team: - allocated_percentage += percentage.allocated_percentage - - if not allocated_percentage == 100: + if sum([member.allocated_percentage for member in self.sales_team]) != 100: frappe.throw(_("Total contribution percentage should be equal to 100")) def check_customer_group_change(self):