diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 6662dd277d1..27f50a0adb8 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -258,6 +258,9 @@ class crm_base(object):
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data}
+ def _case_opportunity_meeting_notification(self, cr, uid, ids, context=None):
+ return True
+
def _case_open_notification(self, case, context=None):
return True
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index f166897a2cb..ef9eff16eac 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -274,8 +274,12 @@ class crm_lead(crm_case, osv.osv):
def _case_create_notification(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
+ if obj.type=="opportunity" and obj.state=="draft":
+ message = _("Opportunity is created.")
+ elif obj.type=="lead" :
+ message = _("Lead is created.")
self.message_append_note(cr, uid, ids, _('System notification'),
- _("Lead is created."), type='notification', need_action_user_id=obj.user_id.id, context=context)
+ message, type='notification', need_action_user_id=obj.user_id.id, context=context)
return True
def _case_open_notification(self, lead, context=None):
@@ -328,13 +332,13 @@ class crm_lead(crm_case, osv.osv):
message = _("The lead is escalated.")
case.message_append_note('' ,message)
- def _case_phonecall_notification(self, case, action, context=None):
- message = _("%s a call for the opportunity %s.") % (action,case.name)
- case.message_append_note('', message, need_action_user_id=case.user_id.id)
-
- def _case_opportunity_meeting_notification(self, case, context=None):
- message = _("The opportunity %s is scheduled for meeting.") % (case.name)
- case.message_append_note('', message, need_action_user_id=case.user_id.id)
+ def _case_phonecall_notification(self, cr, uid, ids, case, phonecall, action, context=None):
+ for obj in phonecall.browse(cr, uid, ids, context=context):
+ if action == "schedule" :
+ message = _("%s a call for the %s.") % (action, obj.date)
+ else :
+ message = _("%s a call.") % (action)
+ case.message_append_note('', message)
def case_open(self, cr, uid, ids, context=None):
res = super(crm_lead, self).case_open(cr, uid, ids, context)
@@ -755,7 +759,7 @@ class crm_lead(crm_case, osv.osv):
if action == 'log':
phonecall.case_close(cr, uid, [new_id])
phonecall_dict[lead.id] = new_id
- self._case_phonecall_notification(lead,action,context=context)
+ self._case_phonecall_notification(cr, uid, [new_id], lead, phonecall, action, context=context)
return phonecall_dict
@@ -873,7 +877,6 @@ class crm_lead(crm_case, osv.osv):
'search_view_id': search_view and search_view[1] or False,
'nodestroy': True
}
- self._case_opportunity_meeting_notification(opp,context=context)
return value
@@ -902,10 +905,10 @@ class crm_lead(crm_case, osv.osv):
for case in self.browse(cr, uid, ids, context=context):
if case.type == 'lead' or context.get('stage_type') == 'lead':
- message = _("The stage of lead %s has been changed to %s.") % (case.name, stage.name)
+ message = _("The stage of lead has been changed to %s.") % (stage.name)
case.message_append_note(text, message)
elif case.type == 'opportunity':
- message = _("The stage of opportunity %s has been changed to %s.") % (case.name, stage.name)
+ message = _("The stage of opportunity has been changed to %s.") % (stage.name)
case.message_append_note(text, message)
return super(crm_lead,self).write(cr, uid, ids, vals, context)
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 7fd703f0bec..699b11b9bfe 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -77,6 +77,9 @@
icon="gtk-go-forward" context="{'stage_type': 'lead'}" />
+
@@ -143,29 +146,6 @@
type="object" icon="gtk-convert" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -176,13 +156,6 @@
-
-
-
-
-
-
-
diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py
index 40ba8662f13..5ba93d526af 100644
--- a/addons/crm/crm_meeting.py
+++ b/addons/crm/crm_meeting.py
@@ -80,6 +80,21 @@ class crm_meeting(crm_base, osv.osv):
'user_id': lambda self, cr, uid, ctx: uid,
}
+ def create(self, cr, uid, vals, context=None):
+ obj_id = super(crm_meeting, self).create(cr, uid, vals, context=context)
+ self._case_opportunity_meeting_notification(cr, uid, [obj_id], context=context)
+ return obj_id
+
+ def _case_opportunity_meeting_notification(self, cr, uid, ids, context=None):
+ lead_obj = self.pool.get('crm.lead')
+
+ for obj in self.browse(cr, uid, ids, context=context):
+ if(obj.opportunity_id.id):
+ newid = obj.opportunity_id.id
+ message = _("scheduled for meeting %s.") % (obj.date)
+ for lead in lead_obj.browse(cr, uid, [newid], context=context):
+ lead.message_append_note('', message)
+
def case_open(self, cr, uid, ids, *args):
"""Confirms meeting
@param self: The object pointer
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 8d9a47b15eb..077bbeb6cbb 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -32,6 +32,7 @@ class crm_phonecall(crm_base, osv.osv):
_name = "crm.phonecall"
_description = "Phonecall"
_order = "id desc"
+ _inherit = ['mail.thread']
_columns = {
# From crm.case
'id': fields.integer('ID', readonly=True),
@@ -71,12 +72,16 @@ class crm_phonecall(crm_base, osv.osv):
type="char", string="Contact", size=128),
'partner_mobile': fields.char('Mobile', size=32),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
- 'date_closed': fields.datetime('Closed', readonly=True),
- 'date': fields.datetime('Date'),
- 'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
+ 'date_closed': fields.datetime('Closed', readonly=True),
+ 'date': fields.datetime('Date'),
+ 'opportunity_id': fields.many2one ('crm.lead', 'Lead/Opportunity'),
'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
+ def create(self, cr, uid, vals, context=None):
+ obj_id = super(crm_phonecall, self).create(cr, uid, vals, context=context)
+ return obj_id
+
def _get_default_state(self, cr, uid, context=None):
if context and context.get('default_state', False):
return context.get('default_state')