Hello All,
I have created a few Employees for Nestorbird Company & also add all the data of that particular employee (i.e. phone no. , employee image, email, birthdate), etc.
But when the birthday reminder has come for an Employee So in that Employee image is not fetching as shown in the below image.
Kindly help me with the same.
This is code :
def get_employees_who_are_born_today():
"""Get all employee born today & group them based on their company"""
from collections import defaultdict
employees_born_today = frappe.db.multisql({
"mariadb": """
SELECT `personal_email`, `company`, `company_email`, `user_id`, `employee_name` AS 'name', `image`
FROM `tabEmployee`
WHERE
DAY(date_of_birth) = DAY(%(today)s)
AND
MONTH(date_of_birth) = MONTH(%(today)s)
AND
`status` = 'Active'
""",
"postgres": """
SELECT "personal_email", "company", "company_email", "user_id", "employee_name" AS 'name', "image"
FROM "tabEmployee"
WHERE
DATE_PART('day', "date_of_birth") = date_part('day', %(today)s)
AND
DATE_PART('month', "date_of_birth") = date_part('month', %(today)s)
AND
"status" = 'Active'
""",
}, dict(today=today()), as_dict=1)
grouped_employees = defaultdict(lambda: [])
for employee_doc in employees_born_today:
grouped_employees[employee_doc.get('company')].append(employee_doc)
return grouped_employees
Thanks in advance