brotherton-erpnext/patches/august_2013/p05_employee_birthdays.py
2013-08-15 14:30:46 +05:30

14 lines
551 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "event")
webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
obj = webnotes.get_obj("Employee", employee)
obj.update_dob_event()