[Minor] Job Offer UX improvise (#15042)

* job offer ux improv

* Update job_offer.js
This commit is contained in:
Zarrar 2018-07-30 10:57:13 +05:30 committed by Nabin Hait
parent cce7c5c245
commit 6004b66797
2 changed files with 13 additions and 2 deletions

View File

@ -13,13 +13,22 @@ frappe.ui.form.on("Job Offer", {
},
refresh: function (frm) {
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted') && (frm.doc.docstatus === 1)) {
if ((!frm.doc.__islocal) && (frm.doc.status == 'Accepted')
&& (frm.doc.docstatus === 1) && (!frm.doc.__onload.employee)) {
frm.add_custom_button(__('Make Employee'),
function () {
erpnext.job_offer.make_employee(frm);
}
);
}
if(frm.doc.__onload.employee) {
frm.add_custom_button(__('Show Employee'),
function () {
frappe.set_route("Form", "Employee", frm.doc.__onload.employee);
}
);
}
}
});

View File

@ -7,7 +7,9 @@ from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
class JobOffer(Document):
pass
def onload(self):
employee = frappe.db.get_value("Employee", {"job_applicant": self.job_applicant}, "name") or ""
self.set_onload("employee", employee)
@frappe.whitelist()
def make_employee(source_name, target_doc=None):