Improved code

This commit is contained in:
Valmik Jangla 2016-02-16 14:47:05 +05:30 committed by Anand Doshi
parent bddc80bc66
commit 93b1072cba

View File

@ -1,6 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.offer_letter");
frappe.ui.form.on("Offer Letter", {
select_terms: function(frm) {
frappe.model.get_value("Terms and Conditions", frm.doc.select_terms, "terms", function(value) {
@ -10,16 +12,20 @@ frappe.ui.form.on("Offer Letter", {
refresh:function(frm){
if((!frm.doc.__islocal) && (frm.doc.status=='Accepted') && (frm.doc.docstatus===1)){
frm.add_custom_button(__('Make Employee'),
frm.cscript['Make Employee']);
}
}
frm.add_custom_button(__('Make Employee'),
function() {
erpnext.offer_letter.make_employee(frm)
}
);
}
}
});
cur_frm.cscript['Make Employee'] = function() {
frappe.model.open_mapped_doc({
method: "erpnext.hr.doctype.employee.employee.make_employee",
frm : cur_frm
});
erpnext.offer_letter.make_employee = function(frm) {
frappe.model.open_mapped_doc({
method: "erpnext.hr.doctype.employee.employee.make_employee",
frm : frm
});
}