From 3f694e2e6d537ebec5891466279ec5fd47455ea7 Mon Sep 17 00:00:00 2001 From: "Rifakat Haradwala (Open ERP)" Date: Thu, 5 May 2011 17:22:42 +0530 Subject: [PATCH] [FIX]: crm: changes regarding *Merge opportunities wizard *Convert opportunities wizard, fix for cr and uid parameter passing bzr revid: rha@tinyerp.com-20110505115242-dsp2161zun8r2wmd --- addons/crm/wizard/crm_lead_to_opportunity.py | 6 +++--- addons/crm/wizard/crm_merge_opportunities.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index f51016e0da7..e81e3006ef0 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -140,13 +140,13 @@ class crm_lead2opportunity_partner(osv.osv_memory): }, context=context) leads.log(cr, uid, lead.id, _("Lead '%s' has been converted to an opportunity.") % lead.name) - def send_mail_to_salesman(self, lead): + def send_mail_to_salesman(self, cr, uid, lead): email_to = lead.user_id and lead.user_id.user_email if not email_to: return False message_pool = self.pool.get('email.message') email_from = lead.section_id and lead.section_id.user_id and lead.section_id.user_id.user_email or email_to - partner = lead.partner_id and lead.partner_id.name or lead.partner_name + partner = lead.partner_id and lead.partner_id.name or lead.partner_name subject = "lead %s converted into opportunity" % lead.name body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description) return message_pool.schedule_with_attach(cr, uid, email_from, [email_to], subject, body) @@ -203,7 +203,7 @@ class crm_lead2opportunity_partner(osv.osv_memory): partner_id = False self._convert(cr, uid, ids, lead, partner_id, stage_ids, context=context) - self.send_mail_to_salesman(lead) + self.send_mail_to_salesman(cr, uid, lead) #If we convert in mass, don't merge if there is no other opportunity but no warning if data.name == 'merge' and (len(data.opportunity_ids) > 1 or not context.get('mass_convert') ): merge_obj = self.pool.get('crm.merge.opportunity') diff --git a/addons/crm/wizard/crm_merge_opportunities.py b/addons/crm/wizard/crm_merge_opportunities.py index fcc09e4a3b3..d339481da92 100644 --- a/addons/crm/wizard/crm_merge_opportunities.py +++ b/addons/crm/wizard/crm_merge_opportunities.py @@ -132,14 +132,14 @@ class crm_merge_opportunity(osv.osv_memory): 'partner_name' : self._get_first_not_null('partner_name', op_ids, oldest_opp), } - + #copy message into the first opportunity + merge attachement - + for opp in tail_opportunities + [first_opportunity]: attach_ids = self.get_attachments(cr, uid, opp, context=context) self.set_attachements_res_id(cr, uid, first_opportunity.id, attach_ids) for history in opp.message_ids: - new_history = message_obj.write(cr, uid, history.id, {'res_id': first_opportunity.id, 'name' : _("From %s : %s") % (opp.name, history.name) }, context=context) + new_history = message_obj.write(cr, uid, history.id, {'res_id': first_opportunity.id, 'name' : _("From %s : %s") % (opp.name, history.subject) }, context=context) #Notification about loss of information details = []