This commit is contained in:
Nijil Y
2011-12-23 17:35:18 +05:30
parent 89e5624730
commit cc64682baa
2 changed files with 24 additions and 16 deletions

View File

@@ -117,20 +117,26 @@ class DocType:
def sent_reminder_task(): def sent_reminder_task():
task_list = sql("select subject, allocated_to, project, exp_start_date, exp_end_date, \ task_list = sql("""
priority, status, name, senders_name, opening_date, review_date, description from tabTicket \ select subject, allocated_to, project, exp_start_date, exp_end_date,
where task_email_notify=1 and sent_reminder=0 and status='Open' and \ priority, status, name, senders_name, opening_date, review_date, description
exp_start_date is not null",as_dict=1) from tabTicket
msgprint(task_list) where task_email_notify=1
and sent_reminder=0
and status='Open'
and exp_start_date is not null""",as_dict=1)
for i in task_list: for i in task_list:
if date_diff(i['exp_start_date'],nowdate())==2: if date_diff(i['exp_start_date'],nowdate()) ==2:
msgprint(i['exp_start_date']) msg2="""<h2>Two days to complete: %(name)s<h2>
msgprint(add_days(nowdate(),2)) <p>This is a reminder for the task %(name)s has been assigned to you
msg2="""This is an auto generated email.<br/><br/>This is a reminder for the task %s has been assigned \ by %(senders_name)s on %(opening_date)s</p>
to you by %s on %s<br/><br/>Project: %s <br/><br/>Review Date: %s \ <p><b>Project:</b> %(project)s</p>
<br/><br/>Details: %s <br/><br/>The expected start date of this task is on %s """ \ <p><b>Review Date:</b> %(review_date)s</p>
%(i['name'], i['senders_name'], i['opening_date'], i['project'], i['review_date'], i['description'], i['exp_start_date']) <p><b>Details:</b> %(description)s</p>
sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1,\ <p>If you have already completed this task, please update the system</p>
<p>Good Luck!</p>
<p>(This notification is autogenerated)</p>""" % i
sendmail(i['allocated_to'], sender='automail@webnotestech.com', msg=msg2,send_now=1, \
subject='A task has been assigned') subject='A task has been assigned')
i['sent_reminder']=1 sql("update `tabTicket` set sent_reminder='1' where name='%(name)s' and allocated_to= '%(allocated_to)s'" % i)

View File

@@ -74,6 +74,7 @@ class DocType:
if self.doc.task_email_notify and (self.doc.allocated_to != self.doc.allocated_to_old): if self.doc.task_email_notify and (self.doc.allocated_to != self.doc.allocated_to_old):
self.doc.allocated_to_old = self.doc.allocated_to self.doc.allocated_to_old = self.doc.allocated_to
self.sent_notification() self.sent_notification()
self.doc.sent_reminder = 0
if self.doc.exp_start_date: if self.doc.exp_start_date:
sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
self.add_calendar_event() self.add_calendar_event()
@@ -96,7 +97,8 @@ class DocType:
self.doc.project, self.doc.review_date, self.doc.closing_date, self.doc.description) self.doc.project, self.doc.review_date, self.doc.closing_date, self.doc.description)
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\ sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', msg=msg2,send_now=1,\
subject='A task has been assigned') subject='A task has been assigned')
self.doc.sent_reminder=0
#validate before closing task #validate before closing task
def validate_for_closed(self): def validate_for_closed(self):