fix: clear contribution table on reselection of sales person

This commit is contained in:
Afshan
2021-10-27 16:18:46 +05:30
committed by chillaranand
parent 90cafeedc7
commit 6e4b94f265
2 changed files with 7 additions and 1 deletions

View File

@@ -18,6 +18,11 @@ frappe.ui.form.on('Sales Commission', {
}
},
sales_person: function (frm) {
frm.clear_table('contributions');
frm.refresh();
},
get_contributions: function (frm) {
frm.clear_table("contributions");
return frappe.call({

View File

@@ -10,7 +10,7 @@ from frappe.utils import get_link_to_form
class SalesCommission(Document):
def validate(self):
self.validate_from_to_dates()
self.validate_amount()
self.validate_salary_component()
self.calculate_total_contribution_and_total_commission_amount()
@@ -27,6 +27,7 @@ class SalesCommission(Document):
frappe.throw(_("Please set {0} in {1}").format(frappe.bold("Salary Component for Sales Commission"), get_link_to_form("Payroll Settings", "Payroll Settings")))
def on_submit(self):
self.validate_amount()
self.db_set("status", "Unpaid")
@frappe.whitelist()