[minor] allow website user to be selected as employee

This commit is contained in:
Rushabh Mehta 2016-12-19 12:32:11 +05:30
parent 99c814b360
commit c3d8479443

View File

@ -5,7 +5,11 @@ frappe.provide("erpnext.hr");
erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({ erpnext.hr.EmployeeController = frappe.ui.form.Controller.extend({
setup: function() { setup: function() {
this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) { this.frm.fields_dict.user_id.get_query = function(doc, cdt, cdn) {
return { query:"frappe.core.doctype.user.user.user_query"} } return {
query: "frappe.core.doctype.user.user.user_query",
filters: {ignore_user_type: 1}
}
}
this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) { this.frm.fields_dict.reports_to.get_query = function(doc, cdt, cdn) {
return { query: "erpnext.controllers.queries.employee_query"} } return { query: "erpnext.controllers.queries.employee_query"} }
}, },
@ -57,7 +61,9 @@ frappe.ui.form.on('Employee',{
frm.events.update_contact(frm) frm.events.update_contact(frm)
}, },
update_contact:function(frm){ update_contact:function(frm){
frm.set_value("prefered_email",frm.fields_dict[frappe.model.scrub(frm.doc.prefered_contact_email)].value) var prefered_email_fieldname = frappe.model.scrub(frm.doc.prefered_contact_email) || 'user_id';
frm.set_value("prefered_email",
frm.fields_dict[prefered_email_fieldname].value)
}, },
status: function(frm) { status: function(frm) {
return frm.call({ return frm.call({