From 76eddcc29fb771a09baaadd252c976d0f4de0136 Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Tue, 16 Apr 2019 16:31:54 +0530 Subject: [PATCH] fix: validate percentage total --- erpnext/selling/doctype/customer/customer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js index 031cf143cc..356dcda8e1 100644 --- a/erpnext/selling/doctype/customer/customer.js +++ b/erpnext/selling/doctype/customer/customer.js @@ -123,5 +123,11 @@ frappe.ui.form.on("Customer", { }, validate: function(frm) { if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name); + + var total = 0; + for (var idx in frm.doc.sales_team) { + total += frm.doc.sales_team[idx].allocated_percentage; + if (total > 100) frappe.throw(__("Total contribution percentage can't exceed 100")); + } }, }); \ No newline at end of file