Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-578303-ado into 
lp:openobject-addons/6.1.

Requested reviews:
  Amit Dodiya (OpenERP) (ado-openerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578303-ado/+merge/120725

Hello,

"[FIX] when we select more than one partner for creating opportunity in 
customers list the wizard will creates the opportunities with wrong data"

Stpes:
1). Install CRM module
2). Open Customers list view and select more than customers
3). Now click on "Create Opportunity" action so the wizard will open which 
contains the wrong "Opportunity Name"(name of first Partner) & 
"Partner"(partner_id of Last Partner) and also creates the opporunity with same 
wrong data.

It should creates the opportunities with selected customers data.

Regards,
Amit Dodiya
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578303-ado/+merge/120725
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-578303-ado.
=== modified file 'crm/wizard/crm_partner_to_opportunity.py'
--- crm/wizard/crm_partner_to_opportunity.py	2011-12-22 09:10:55 +0000
+++ crm/wizard/crm_partner_to_opportunity.py	2012-08-23 08:55:29 +0000
@@ -53,23 +53,24 @@
             if 'name' in fields:
                 res.update({'name': partner.name})
             if 'partner_id' in fields:
-                res.update({'partner_id': data and data[0] or False})
+                res.update({'partner_id': partner.id or False})
         return res
 
     def make_opportunity(self, cr, uid, ids, context=None):
         partner_ids = context and context.get('active_ids', []) or []
-        partner_id = partner_ids[0] if partner_ids else None
         partner = self.pool.get('res.partner')
         lead = self.pool.get('crm.lead')
         data = self.browse(cr, uid, ids, context=context)[0]
-        opportunity_ids = partner.make_opportunity(cr, uid, partner_ids,
-            data.name,
-            data.planned_revenue,
-            data.probability,
-            partner_id,
-            context=context,
-        )
-        opportunity_id = opportunity_ids[partner_ids[0]]
+        partner_records = partner.browse(cr, uid, partner_ids, context=context)
+        for record in partner_records:
+            opportunity_ids = partner.make_opportunity(cr, uid, [record.id],
+                record.name,
+                data.planned_revenue,
+                data.probability,
+                record.id,
+                context=context,
+            )
+        opportunity_id = opportunity_ids[record.id]
         return lead.redirect_opportunity_view(cr, uid, opportunity_id, context=context)
 
 crm_partner2opportunity()

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to