diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 1f0aff5057b..7eec2a5015a 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -259,19 +259,24 @@ class crm_base(object):
return {'value': data}
def case_open_send_note(self, cr, uid, ids, context=None):
- return True
+ msg = '%s has been opened.' % (context['msg_prefix'] if context['msg_prefix'] else '')
+ return self.message_append_note(cr, uid, ids, 'System Notification', msg, context=context)
def case_close_send_note(self, cr, uid, ids, context=None):
- return True
+ msg = '%s has been closed.' % (context['msg_prefix'] if context['msg_prefix'] else '')
+ return self.message_append_note(cr, uid, ids, 'System Notification', msg, context=context)
def case_cancel_send_note(self, cr, uid, ids, context=None):
- return True
+ msg = '%s has been canceled.' % (context['msg_prefix'] if context['msg_prefix'] else '')
+ return self.message_append_note(cr, uid, ids, 'System Notification', msg, context=context)
def case_pending_send_note(self, cr, uid, ids, context=None):
- return True
+ msg = '%s is now pending.' % (context['msg_prefix'] if context['msg_prefix'] else '')
+ return self.message_append_note(cr, uid, ids, 'System Notification', msg, context=context)
def case_reset_send_note(self, cr, uid, ids, context=None):
- return True
+ msg = '%s has been renewed.' % (context['msg_prefix'] if context['msg_prefix'] else '')
+ return self.message_append_note(cr, uid, ids, 'System Notification', msg, context=context)
def case_open(self, cr, uid, ids, context=None):
"""Opens Case
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index a8ec106e6de..f5dffebb436 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -279,12 +279,6 @@ class crm_lead(crm_case, osv.osv):
result[obj.id] = obj.user_id.id
return result
- def case_reset_send_note(self, cr, uid, ids, context=None):
- for lead in self.browse(cr, uid, ids, context=context):
- message = _("%s has been renewed.") % ('Opportunity' if lead.type == 'opportunity' else 'Lead')
- lead.message_append_note('' ,message)
- return True
-
def case_create_send_note(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context=context):
self.message_subscribe(cr, uid, ids, [lead.user_id.id], context=context)
@@ -296,17 +290,35 @@ class crm_lead(crm_case, osv.osv):
def case_open_send_note(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context=context):
if lead.state == 'draft' and lead.state == 'pending':
- return False
- message = _("%s has been opened.") % ('Opportunity' if lead.type == 'opportunity' else 'Lead')
- lead.message_append_note('' ,message)
+ continue
+ context['msg_prefix'] = 'Opportunity' if lead.type == 'opportunity' else 'Lead'
+ super(crm_lead, self).case_open_send_note(cr, uid, [lead.id], context=context)
return True
def case_close_send_note(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context=context):
- message = _("%s has been closed.") % ('Opportunity' if lead.type == 'opportunity' else 'Lead')
- lead.message_append_note('' ,message)
+ context['msg_prefix'] = 'Opportunity' if lead.type == 'opportunity' else 'Lead'
+ super(crm_lead, self).case_close_send_note(cr, uid, ids, context=context)
return True
+ def case_cancel_send_note(self, cr, uid, ids, context=None):
+ for lead in self.browse(cr, uid, ids, context=context):
+ context['msg_prefix'] = 'Opportunity' if lead.type == 'opportunity' else 'Lead'
+ super(crm_lead, self).case_cancel_send_note(cr, uid, ids, context=context)
+ return True
+
+ def case_pending_send_note(self, cr, uid, ids, context=None):
+ for lead in self.browse(cr, uid, ids, context=context):
+ context['msg_prefix'] = 'Opportunity' if lead.type == 'opportunity' else 'Lead'
+ super(crm_lead, self).case_pending_send_note(cr, uid, ids, context=context)
+ return True
+
+ def case_reset_send_note(self, cr, uid, ids, context=None):
+ for lead in self.browse(cr, uid, ids, context=context):
+ context['msg_prefix'] = 'Opportunity' if lead.type == 'opportunity' else 'Lead'
+ super(crm_lead, self).case_reset_send_note(cr, uid, ids, context=context)
+ return True
+
def case_mark_lost_send_note(self, cr, uid, ids, context=None):
for opportunity in self.browse(cr, uid, ids, context=context):
message = _("Opportunity has been marked as lost.")
@@ -319,18 +331,6 @@ class crm_lead(crm_case, osv.osv):
opportunity.message_append_note('' ,message)
return True
- def case_cancel_send_note(self, cr, uid, ids, context=None):
- for lead in self.browse(cr, uid, ids, context=context):
- message = _("%s has been cancelled.") % ('Opportunity' if lead.type == 'opportunity' else 'Lead')
- lead.message_append_note('' ,message)
- return True
-
- def case_pending_send_note(self, cr, uid, ids, context=None):
- for lead in self.browse(cr, uid, ids, context=context):
- message = _("%s is pending.") % ('Opportunity' if lead.type == 'opportunity' else 'Lead')
- lead.message_append_note('' ,message)
- return True
-
def case_escalate_send_note(self, cr, uid, ids, context=None):
for lead in self.browse(cr, uid, ids, context=context):
message = _("Lead has been escalated.")