diff --git a/erpnext/projects/doctype/project_control/project_control.py b/erpnext/projects/doctype/project_control/project_control.py index 2702ff9b96..c6e9102cf0 100644 --- a/erpnext/projects/doctype/project_control/project_control.py +++ b/erpnext/projects/doctype/project_control/project_control.py @@ -1,13 +1,13 @@ # Please edit this list and import only required elements import webnotes -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add +from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, set_default, str_esc_quote, user_format, validate_email_add, add_days from webnotes.model import db_exists from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType from webnotes.model.doclist import getlist, copy_doclist from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax from webnotes import session, form, is_testing, msgprint, errprint - +from webnotes.utils.email_lib import sendmail set = webnotes.conn.set sql = webnotes.conn.sql get_value = webnotes.conn.get_value @@ -114,3 +114,17 @@ class DocType: else: sql("update `tabProject` set status = 'Completed' where name = %s", arg) return cstr('true') +def sent_reminder_task(self): + task_list = sql("select subject, allocated_to, project, exp_start_date, exp_end_date, \ + priority, status, name from tabTicket where email_notify=1 and reminder=0 and status='Open'",as_dict=1) + for i in task_list: + if (add_days(nowdate(),2) > i['exp_start_date']) and (add_days(nowdate(),3) < i['exp_start_date']): + msg2="""This is an auto generated email.

This is a reminder for the task %s has been assigned \ + to you by %s on %s

Project: %s

Review Date: %s

Closing Date: %s \ +

Details: %s

""" \ + %(self.doc.name, self.doc.senders_name, self.doc.opening_date, \ + 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,\ + subject='A task has been assigned') + self.doc.sent_reminder=1 + diff --git a/erpnext/projects/doctype/ticket/ticket.py b/erpnext/projects/doctype/ticket/ticket.py index 250c4390ec..1868eeb93d 100644 --- a/erpnext/projects/doctype/ticket/ticket.py +++ b/erpnext/projects/doctype/ticket/ticket.py @@ -76,13 +76,7 @@ class DocType: return else: self.doc.allocated_to_old = self.doc.allocated_to - msg2="""This is an auto generated email.
A task %s has been assigned to you by %s on %s

\ - Project: %s

Review Date: %s

Closing Date: %s

Details: %s

""" \ - %(self.doc.name, self.doc.senders_name, self.doc.opening_date, \ - 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,\ - subject='A task has been assigned') - self.doc.sent_reminder=0 + self.sent_notification() if self.doc.exp_start_date: sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) self.add_calendar_event() @@ -96,6 +90,15 @@ class DocType: msgprint("Please enter allocated_to.") raise Exception self.validate_with_timesheet_dates() + #Sent Notification + def sent_notification(self): + msg2="""This is an auto generated email.
A task %s has been assigned to you by %s on %s

\ + Project: %s

Review Date: %s

Closing Date: %s

Details: %s

""" \ + %(self.doc.name, self.doc.senders_name, self.doc.opening_date, \ + 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,\ + subject='A task has been assigned') + self.doc.sent_reminder=0 #validate before closing task def validate_for_closed(self): diff --git a/erpnext/projects/doctype/ticket/ticket.txt b/erpnext/projects/doctype/ticket/ticket.txt index 4d18953f78..6efae3e82d 100644 --- a/erpnext/projects/doctype/ticket/ticket.txt +++ b/erpnext/projects/doctype/ticket/ticket.txt @@ -5,14 +5,14 @@ { 'creation': '2011-01-28 17:52:35', 'docstatus': 0, - 'modified': '2011-12-22 14:31:07', + 'modified': '2011-12-23 11:13:42', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1324468340', + '_last_update': '1324544468', 'allow_trash': 1, 'autoname': 'TIC/.####', 'colour': 'White:FFF', @@ -26,7 +26,7 @@ 'show_in_menu': 0, 'subject': '%(subject)s', 'tag_fields': 'status', - 'version': 250 + 'version': 251 }, # These values are common for all DocField @@ -290,7 +290,7 @@ { 'doctype': 'DocField', 'fieldname': 'sent_reminder', - 'fieldtype': 'Date', + 'fieldtype': 'Data', 'hidden': 1, 'label': 'Sent Reminder', 'no_copy': 1,