update
This commit is contained in:
parent
7e812bbee0
commit
8acb043a8a
@ -1,12 +1,14 @@
|
|||||||
# Please edit this list and import only required elements
|
# Please edit this list and import only required elements
|
||||||
import webnotes
|
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
|
||||||
|
from webnotes.util.email_lib import sendmail
|
||||||
from webnotes.model import db_exists
|
from webnotes.model import db_exists
|
||||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||||
from webnotes.model.doclist import getlist, copy_doclist
|
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.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 import session, form, is_testing, msgprint, errprint
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
set = webnotes.conn.set
|
set = webnotes.conn.set
|
||||||
get_value = webnotes.conn.get_value
|
get_value = webnotes.conn.get_value
|
||||||
@ -69,14 +71,20 @@ class DocType:
|
|||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
if (self.doc.status =='Open') and (self.doc.task_email_notify==1):
|
if (self.doc.status =='Open') and (self.doc.task_email_notify==1):
|
||||||
msg2= 'A task %s has been assigned to you by %s on %s <br/> \
|
if (self.doc.allocated_to == self.doc.allocated_to_old):
|
||||||
Project:%s <br/> Review Date:%s <br /> Closing Date:%s <br /> Details %s' \
|
return
|
||||||
%(self.doc.name,self.doc.senders_name,self.doc.opening_date,self.doc.project, \
|
else:
|
||||||
self.doc.review_date,self.doc.closing_date,self.doc.description)
|
self.doc.allocated_to_old = self.doc.allocated_to
|
||||||
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com', \
|
msg2="""A task %s has been assigned to you by %s on %s<br/><br/>Project: %s <br/><br/> \
|
||||||
subject='A task has been assigned', parts=[['text/plain',msg2]])
|
Review Date: %s<br/><br/>Closing Date: %s <br/><br/>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)
|
||||||
|
self.add_calendar_event()
|
||||||
|
sendmail(self.doc.allocated_to, sender='automail@webnotestech.com',subject='A task has been assigned',\
|
||||||
|
parts=[['text/plain',msg2]])
|
||||||
|
self.doc.sent_reminder=0
|
||||||
pass
|
pass
|
||||||
|
#Function to be called from server inside scheduler ... set reminder/events
|
||||||
#validate before sending for approval
|
#validate before sending for approval
|
||||||
def validate_for_pending_review(self):
|
def validate_for_pending_review(self):
|
||||||
if not self.doc.allocated_to:
|
if not self.doc.allocated_to:
|
||||||
@ -170,6 +178,22 @@ class DocType:
|
|||||||
set(self.doc, 'docstatus', 2)
|
set(self.doc, 'docstatus', 2)
|
||||||
self.doc.save()
|
self.doc.save()
|
||||||
return cstr('true')
|
return cstr('true')
|
||||||
|
# def delete_event_from_calender(self): Add later
|
||||||
|
|
||||||
|
def add_calendar_event(self):
|
||||||
|
in_calendar_of = self.doc.allocated_to
|
||||||
|
event = Document('Event')
|
||||||
|
event.owner = in_calendar_of
|
||||||
|
event.description =''
|
||||||
|
#'Task:%s <br/> By:%s <br/> Project:%s <br/>Details:%s' \
|
||||||
|
#%(self.doc.name,self.doc.senders_name,self.doc.project,self.doc.details)
|
||||||
|
event.event_date = self.doc.exp_start_date
|
||||||
|
event.event_hour = self.doc.exp_total_hrs and exp_total_hrs or ''
|
||||||
|
event.event_type = 'Private'
|
||||||
|
event.ref_type = 'Task'
|
||||||
|
event.ref_name = self.doc.name
|
||||||
|
event.save(1)
|
||||||
|
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
self.cancel_task()
|
self.cancel_task()
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
{
|
{
|
||||||
'creation': '2011-01-28 17:52:35',
|
'creation': '2011-01-28 17:52:35',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2011-12-21 16:32:30',
|
'modified': '2011-12-21 17:22:20',
|
||||||
'modified_by': 'Administrator',
|
'modified_by': 'Administrator',
|
||||||
'owner': 'Administrator'
|
'owner': 'Administrator'
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocType
|
# These values are common for all DocType
|
||||||
{
|
{
|
||||||
'_last_update': '1324394580',
|
'_last_update': '1324465350',
|
||||||
'allow_trash': 1,
|
'allow_trash': 1,
|
||||||
'autoname': 'TIC/.####',
|
'autoname': 'TIC/.####',
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
@ -26,7 +26,7 @@
|
|||||||
'show_in_menu': 0,
|
'show_in_menu': 0,
|
||||||
'subject': '%(subject)s',
|
'subject': '%(subject)s',
|
||||||
'tag_fields': 'status',
|
'tag_fields': 'status',
|
||||||
'version': 247
|
'version': 248
|
||||||
},
|
},
|
||||||
|
|
||||||
# These values are common for all DocField
|
# These values are common for all DocField
|
||||||
@ -249,6 +249,16 @@
|
|||||||
'width': '50%'
|
'width': '50%'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# DocField
|
||||||
|
{
|
||||||
|
'doctype': 'DocField',
|
||||||
|
'fieldname': 'allocated_to_old',
|
||||||
|
'fieldtype': 'Link',
|
||||||
|
'hidden': 1,
|
||||||
|
'label': 'Allocated To Old',
|
||||||
|
'permlevel': 0
|
||||||
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
{
|
{
|
||||||
'colour': 'White:FFF',
|
'colour': 'White:FFF',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user