Merge branch 'master' of github.com:webnotes/erpnext into responsive

This commit is contained in:
Anand Doshi 2013-06-10 15:38:31 +05:30
commit 097ac352d6
4 changed files with 11 additions and 8 deletions

View File

@ -9,6 +9,9 @@ def execute():
for ref_name in webnotes.conn.sql_list("""select ref_name for ref_name in webnotes.conn.sql_list("""select ref_name
from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt): from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
if webnotes.conn.exists(dt, ref_name): if webnotes.conn.exists(dt, ref_name):
if dt in ["Lead", "Opportunity"]:
webnotes.get_obj(dt, ref_name).add_calendar_event(force=True)
else:
webnotes.get_obj(dt, ref_name).add_calendar_event() webnotes.get_obj(dt, ref_name).add_calendar_event()
else: else:
# remove events where ref doc doesn't exist # remove events where ref doc doesn't exist

View File

@ -65,14 +65,14 @@ class DocType(SellingController):
self.check_email_id_is_unique() self.check_email_id_is_unique()
self.add_calendar_event() self.add_calendar_event()
def add_calendar_event(self, opts=None): def add_calendar_event(self, opts=None, force=False):
super(DocType, self).add_calendar_event({ super(DocType, self).add_calendar_event({
"owner": self.doc.lead_owner, "owner": self.doc.lead_owner,
"subject": ('Contact ' + cstr(self.doc.lead_name)), "subject": ('Contact ' + cstr(self.doc.lead_name)),
"description": ('Contact ' + cstr(self.doc.lead_name)) + \ "description": ('Contact ' + cstr(self.doc.lead_name)) + \
(self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \ (self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \
(self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '') (self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '')
}) }, force)
def check_email_id_is_unique(self): def check_email_id_is_unique(self):
if self.doc.email_id: if self.doc.email_id:

View File

@ -93,7 +93,7 @@ class DocType(TransactionBase):
self.add_calendar_event() self.add_calendar_event()
def add_calendar_event(self, opts=None): def add_calendar_event(self, opts=None, force=False):
if not opts: if not opts:
opts = webnotes._dict() opts = webnotes._dict()
@ -116,7 +116,7 @@ class DocType(TransactionBase):
if self.doc.to_discuss: if self.doc.to_discuss:
opts.description += ' To Discuss : ' + cstr(self.doc.to_discuss) opts.description += ' To Discuss : ' + cstr(self.doc.to_discuss)
super(DocType, self).add_calendar_event(opts) super(DocType, self).add_calendar_event(opts, force)
def set_last_contact_date(self): def set_last_contact_date(self):
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date: if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:

View File

@ -271,9 +271,9 @@ class TransactionBase(StatusUpdater):
if not self.doc.posting_time: if not self.doc.posting_time:
self.doc.posting_time = now_datetime().strftime('%H:%M:%S') self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
def add_calendar_event(self, opts): def add_calendar_event(self, opts, force=False):
if self.doc.contact_by != cstr(self._prev.contact_by) or \ if self.doc.contact_by != cstr(self._prev.contact_by) or \
self.doc.contact_date != cstr(self._prev.contact_date): self.doc.contact_date != cstr(self._prev.contact_date) or force:
self.delete_events() self.delete_events()
self._add_calendar_event(opts) self._add_calendar_event(opts)