[FIX]: crm: changes regarding

*Merge opportunities wizard
*Convert opportunities wizard, fix for cr and uid parameter passing

bzr revid: rha@tinyerp.com-20110505115242-dsp2161zun8r2wmd
This commit is contained in:
Rifakat Haradwala (Open ERP)
2011-05-05 17:22:42 +05:30
parent 85c0dce74e
commit 3f694e2e6d
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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')
+3 -3
View File
@@ -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 = []