[minor] moved make_employee from Employee to Offer Letter
This commit is contained in:
parent
5e771c5678
commit
870d0441a8
@ -187,20 +187,6 @@ def make_salary_structure(source_name, target=None):
|
||||
target.make_earn_ded_table()
|
||||
return target
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_employee(source_name, target_doc=None):
|
||||
def set_missing_values(source, target):
|
||||
target.personal_email = frappe.db.get_value("Job Applicant", source.job_applicant, "email_id")
|
||||
doc = get_mapped_doc("Offer Letter", source_name, {
|
||||
"Offer Letter": {
|
||||
"doctype": "Employee",
|
||||
"field_map": {
|
||||
"applicant_name": "employee_name",
|
||||
}}
|
||||
}, target_doc, set_missing_values)
|
||||
return doc
|
||||
|
||||
def validate_employee_role(doc, method):
|
||||
# called via User hook
|
||||
if "Employee" in [d.role for d in doc.get("user_roles")]:
|
||||
|
@ -18,14 +18,13 @@ frappe.ui.form.on("Offer Letter", {
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
erpnext.offer_letter.make_employee = function(frm) {
|
||||
erpnext.offer_letter.make_employee = function(frm) {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.hr.doctype.employee.employee.make_employee",
|
||||
frm : frm
|
||||
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
|
||||
frm: frm
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -4,6 +4,21 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
class OfferLetter(Document):
|
||||
pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_employee(source_name, target_doc=None):
|
||||
def set_missing_values(source, target):
|
||||
target.personal_email = frappe.db.get_value("Job Applicant", source.job_applicant, "email_id")
|
||||
doc = get_mapped_doc("Offer Letter", source_name, {
|
||||
"Offer Letter": {
|
||||
"doctype": "Employee",
|
||||
"field_map": {
|
||||
"applicant_name": "employee_name",
|
||||
}}
|
||||
}, target_doc, set_missing_values)
|
||||
return doc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user