Added Is Active to Sales Person

This commit is contained in:
Kanchan Chauhan
2016-12-12 11:12:07 +05:30
parent 58667ab123
commit f0b0db444d
5 changed files with 58 additions and 6 deletions

View File

@@ -58,6 +58,15 @@ frappe.ui.form.on('Employee',{
},
update_contact:function(frm){
frm.set_value("prefered_email",frm.fields_dict[frappe.model.scrub(frm.doc.prefered_contact_email)].value)
}
},
status: function(frm) {
return frm.call({
method: "deactivate_sales_person",
args: {
employee: frm.doc.employee,
status: frm.doc.status
}
});
},
});
cur_frm.cscript = new erpnext.hr.EmployeeController({frm: cur_frm});

View File

@@ -244,3 +244,9 @@ def is_holiday(employee, date=None):
if holiday_list:
return frappe.get_all('Holiday List', dict(name=holiday_list, holiday_date=date)) and True or False
@frappe.whitelist()
def deactivate_sales_person(status = None, employee = None):
if status == "Left":
sales_person = frappe.db.get_value("Sales Person", {"Employee": employee})
if sales_person:
frappe.db.set_value("Sales Person", sales_person, "enabled", 0)