From e04c1215eac395f9c77edb89b237d29d1fa7d416 Mon Sep 17 00:00:00 2001 From: "Bhumi Thakkar (Open ERP)" Date: Tue, 28 Feb 2012 19:08:04 +0530 Subject: [PATCH] [IMP] put a date for schedule a call notification,meeting notification with date in crm lead and notification with need action in crm meeting,conert phonecall into opportunity notification put. bzr revid: bth@tinyerp.com-20120228133804-cbynhdwlw4pf1wg2 --- addons/crm/crm.py | 3 +++ addons/crm/crm_lead.py | 27 +++++++++++++++------------ addons/crm/crm_lead_view.xml | 33 +++------------------------------ addons/crm/crm_meeting.py | 15 +++++++++++++++ addons/crm/crm_phonecall.py | 11 ++++++++--- 5 files changed, 44 insertions(+), 45 deletions(-) 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'}" /> +