[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()
|
target.make_earn_ded_table()
|
||||||
return target
|
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):
|
def validate_employee_role(doc, method):
|
||||||
# called via User hook
|
# called via User hook
|
||||||
if "Employee" in [d.role for d in doc.get("user_roles")]:
|
if "Employee" in [d.role for d in doc.get("user_roles")]:
|
||||||
|
@ -22,10 +22,9 @@ 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({
|
frappe.model.open_mapped_doc({
|
||||||
method: "erpnext.hr.doctype.employee.employee.make_employee",
|
method: "erpnext.hr.doctype.offer_letter.offer_letter.make_employee",
|
||||||
frm : frm
|
frm: frm
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
@ -4,6 +4,21 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
|
||||||
class OfferLetter(Document):
|
class OfferLetter(Document):
|
||||||
pass
|
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