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,7 +9,10 @@ def execute():
for ref_name in webnotes.conn.sql_list("""select ref_name
from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
if webnotes.conn.exists(dt, ref_name):
webnotes.get_obj(dt, ref_name).add_calendar_event()
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()
else:
# remove events where ref doc doesn't exist
webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`

View File

@ -65,14 +65,14 @@ class DocType(SellingController):
self.check_email_id_is_unique()
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({
"owner": self.doc.lead_owner,
"subject": ('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.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '')
})
}, force)
def check_email_id_is_unique(self):
if self.doc.email_id:

View File

@ -93,7 +93,7 @@ class DocType(TransactionBase):
self.add_calendar_event()
def add_calendar_event(self, opts=None):
def add_calendar_event(self, opts=None, force=False):
if not opts:
opts = webnotes._dict()
@ -116,7 +116,7 @@ class DocType(TransactionBase):
if 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):
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:
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 \
self.doc.contact_date != cstr(self._prev.contact_date):
self.doc.contact_date != cstr(self._prev.contact_date) or force:
self.delete_events()
self._add_calendar_event(opts)
@ -358,4 +358,4 @@ def validate_currency(args, item, meta=None):
args.plc_conversion_rate = flt(args.plc_conversion_rate,
get_field_precision(meta.get_field("plc_conversion_rate"),
webnotes._dict({"fields": args})))