diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py index db98e2b788..8bb96539f5 100644 --- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py @@ -143,6 +143,8 @@ class TestSalarySlip(unittest.TestCase): "department": frappe.get_all("Department", fields="name")[0].name, "gender": "Female", "company_email": user, + "prefered_contact_email": "Company Email", + "prefered_email": user, "status": "Active", "employment_type": "Intern" }).insert() diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 31eb2c5571..84312b87db 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -339,3 +339,4 @@ finally:erpnext.patches.v7_0.update_timesheet_communications erpnext.patches.v7_0.update_status_of_zero_amount_sales_order erpnext.patches.v7_1.add_field_for_task_dependent erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty +erpnext.patches.v7_1.set_prefered_contact_email \ No newline at end of file diff --git a/erpnext/patches/v7_1/set_prefered_contact_email.py b/erpnext/patches/v7_1/set_prefered_contact_email.py new file mode 100644 index 0000000000..d662e0dc04 --- /dev/null +++ b/erpnext/patches/v7_1/set_prefered_contact_email.py @@ -0,0 +1,19 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + for d in frappe.get_all("Employee"): + employee = frappe.get_doc("Employee", d.name) + if employee.company_email: + employee.prefered_contact_email = "Company Email" + employee.prefered_email = employee.company_email + elif employee.personal_email: + employee.prefered_contact_email = "Personal Email" + employee.prefered_email = employee.personal_email + elif employee.user_id: + employee.prefered_contact_email = "User ID" + employee.prefered_email = employee.user_id + + employee.flags.ignore_mandatory = True + employee.flags.ignore_validate = True + employee.save() \ No newline at end of file