fix: python side validation
This commit is contained in:
parent
76eddcc29f
commit
5ca977a41c
@ -124,10 +124,5 @@ frappe.ui.form.on("Customer", {
|
|||||||
validate: function(frm) {
|
validate: function(frm) {
|
||||||
if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
|
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"));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
@ -60,6 +60,12 @@ class Customer(TransactionBase):
|
|||||||
if self.loyalty_program == customer.loyalty_program and not self.loyalty_program_tier:
|
if self.loyalty_program == customer.loyalty_program and not self.loyalty_program_tier:
|
||||||
self.loyalty_program_tier = customer.loyalty_program_tier
|
self.loyalty_program_tier = customer.loyalty_program_tier
|
||||||
|
|
||||||
|
allocated_percentage = 0
|
||||||
|
for percentage in self.sales_team:
|
||||||
|
allocated_percentage += percentage.allocated_percentage
|
||||||
|
if allocated_percentage > 100:
|
||||||
|
frappe.throw(_("Total contribution percentage can't exceed 100"))
|
||||||
|
|
||||||
def check_customer_group_change(self):
|
def check_customer_group_change(self):
|
||||||
frappe.flags.customer_group_changed = False
|
frappe.flags.customer_group_changed = False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user