2019-12-25 09:44:52 +00:00
|
|
|
import frappe
|
|
|
|
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
employees = frappe.get_all(
|
|
|
|
"Employee",
|
|
|
|
filters={"prefered_email": ""},
|
|
|
|
fields=["name", "prefered_contact_email", "company_email", "personal_email", "user_id"],
|
|
|
|
)
|
|
|
|
|
|
|
|
for employee in employees:
|
2019-12-27 11:37:35 +00:00
|
|
|
if not employee.prefered_contact_email:
|
2019-12-25 09:44:52 +00:00
|
|
|
continue
|
|
|
|
|
2019-12-27 11:37:35 +00:00
|
|
|
preferred_email_field = frappe.scrub(employee.prefered_contact_email)
|
|
|
|
|
2019-12-25 09:44:52 +00:00
|
|
|
preferred_email = employee.get(preferred_email_field)
|
|
|
|
frappe.db.set_value(
|
|
|
|
"Employee", employee.name, "prefered_email", preferred_email, update_modified=False
|
|
|
|
)
|