From 313f9da8f6ca745ffd8df95da0068759dfc03046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 20 Mar 2012 14:23:19 +0100 Subject: [PATCH] [IMP] crm_meeting.py: updated get_need_action_user_id to ..._ids. Cleaned a bit the code. bzr revid: tde@openerp.com-20120320132319-jn6tidpddklvb0ym --- addons/crm/crm_meeting.py | 49 ++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index d2c738c19a1..41b49da5491 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -85,46 +85,37 @@ class crm_meeting(crm_base, osv.osv): self.create_send_note(cr, uid, [obj_id], context=context) return obj_id - def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None): - result = {} + def get_needaction_user_ids(self, cr, uid, ids, context=None): + result = dict.fromkeys(ids, []) for obj in self.browse(cr, uid, ids, context=context): - result[obj.id] = False if (obj.state == 'draft' and obj.user_id): - result[obj.id] = obj.user_id.id + result[obj.id] = [obj.user_id.id] return result def create_send_note(self, cr, uid, ids, context=None): lead_obj = self.pool.get('crm.lead') phonecall_obj = self.pool.get('crm.phonecall') - for obj in self.browse(cr, uid, ids, context=context): - message = _("The meeting has been scheduled on %s.") % (obj.date) - if(obj.opportunity_id.id): # meeting can be create from phonecalls or opportunities, therefore checking for the parent - newid = obj.opportunity_id.id - for lead in lead_obj.browse(cr, uid, [newid], context=context): - opp_message = _("Meeting linked to the opportunity %s has been created and scheduled on %s.") % (lead.name,obj.date) - lead.message_append_note('', message) - obj.message_append_note('', opp_message) - elif(obj.phonecall_id.id): - newid = obj.phonecall_id.id - for phonecall in phonecall_obj.browse(cr, uid, [newid], context=context): - phn_message = _("Meeting linked to the phonecall %s has been created and scheduled on %s.") % (phonecall.name,obj.date) - phonecall.message_append_note('', message) - obj.message_append_note('', phn_message) - else: - message = _("Meeting has been scheduled on %s.") % (obj.date) - obj.message_append_note('', message) - - def case_close_send_note(self, cr, uid, ids, context=None): for meeting in self.browse(cr, uid, ids, context=context): - message = _("Meeting has been done.") - meeting.message_append_note('' ,message) + message = _("A meeting has been scheduled on %s.") % (meeting.date) + if meeting.opportunity_id: # meeting can be create from phonecalls or opportunities, therefore checking for the parent + lead = meeting.opportunity_id + parent_message = _("Meeting linked to the opportunity %s has been created and cscheduled on %s.") % (lead.name, meeting.date) + lead.message_append_note('System Notification', message) + elif meeting.phonecall_id: + phonecall = meeting.phonecall_id + parent_message = _("Meeting linked to the phonecall %s has been created and cscheduled on %s.") % (phonecall.name, meeting.date) + phonecall.message_append_note('System Notification', message) + if parent_message: + meeting.message_append_note('System Notification', parent_message) return True + + def case_close_send_note(self, cr, uid, ids, context=None): + message = _("Meeting has been done.") + return self.message_append_note(cr, uid, ids, message, context=context) def case_reset_send_note(self, cr, uid, ids, context=None): - for meeting in self.browse(cr, uid, ids, context=context): - message = _("Meeting has been renewed.") - meeting.message_append_note('' ,message) - return True + message = _("Meeting has been renewed.") + return self.message_append_note(cr, uid, ids, message, context=context) def case_open_send_note(self, cr, uid, ids, context=None): for meeting in self.browse(cr, uid, ids, context=context):