mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix: Employee birthday reminder
This commit is contained in:
@@ -330,12 +330,13 @@ def send_birthday_reminder(recipients, reminder_text, birthday_persons, message)
|
|||||||
def get_employees_who_are_born_today():
|
def get_employees_who_are_born_today():
|
||||||
"""Get all employee born today & group them based on their company"""
|
"""Get all employee born today & group them based on their company"""
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
employees_born_today = frappe.db.get_all("Employee",
|
employees_born_today = frappe.db.sql("""
|
||||||
fields=["personal_email", "company", "company_email", "user_id", "employee_name as name", "image"],
|
SELECT `personal_email`, `company`, `company_email`, `user_id`, `employee_name` as 'name', `image`
|
||||||
filters={
|
FROM `tabEmployee`
|
||||||
"date_of_birth": ("like", "{}".format(format_datetime(getdate(), "-MM-dd"))),
|
WHERE DAY(date_of_birth) = DAY(CURDATE())
|
||||||
"status": "Active",
|
AND MONTH(date_of_birth) = MONTH(CURDATE())
|
||||||
})
|
AND `status` = 'Active'
|
||||||
|
""", as_dict=1)
|
||||||
|
|
||||||
grouped_employees = defaultdict(lambda: [])
|
grouped_employees = defaultdict(lambda: [])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user