Merge branch 'master' of github.com:webnotes/erpnext into responsive
diff --git a/patches/june_2013/p04_fix_event_for_lead_oppty_project.py b/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
index 6929eed..3f66d8b 100644
--- a/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
+++ b/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
@@ -9,7 +9,10 @@
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`
diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py
index 0e27261..a54343a 100644
--- a/selling/doctype/lead/lead.py
+++ b/selling/doctype/lead/lead.py
@@ -65,14 +65,14 @@
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:
diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py
index 0540ac9..9fb061b 100644
--- a/selling/doctype/opportunity/opportunity.py
+++ b/selling/doctype/opportunity/opportunity.py
@@ -93,7 +93,7 @@
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 @@
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:
diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py
index 011986d..c17df6d 100644
--- a/utilities/transaction_base.py
+++ b/utilities/transaction_base.py
@@ -271,9 +271,9 @@
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 @@
args.plc_conversion_rate = flt(args.plc_conversion_rate,
get_field_precision(meta.get_field("plc_conversion_rate"),
webnotes._dict({"fields": args})))
-
\ No newline at end of file
+