Merge pull request #17253 from hrwX/sales_percentage_validate_v11

fix(Customer): validate percentage total
This commit is contained in:
Nabin Hait
2019-04-17 17:28:50 +05:30
committed by GitHub

View File

@@ -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"));
}
},
});