← Back to team overview

openerp-india team mailing list archive

[Bug 1208436] Re: Lead to opportunity wizard: partner not created when existing partner found, even when choosing 'create' in the wizard

 

** Branch linked: lp:~jeffery9/ocb-addons/ocb-addons-fixups

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1208436

Title:
  Lead to opportunity wizard: partner not created when existing partner
  found, even when choosing 'create' in the wizard

Status in OpenERP Addons (modules):
  Fix Committed

Bug description:
  Steps to reproduce:
  1) Launch the lead to opportunity wizard for a lead with contact info that corresponds to an existing partner (but this partner is not selected in the lead).
  2) When the wizard opens, it automatically suggests to 'link with existing partner'.
  3) Choose 'create new partner' instead and click 'create opportunity'.

  Result:
  The opportunity is linked to the existing partner. No new partner is created, even though that's what I selected in the wizard.

  Cause:
  In crm_lead2opportunity_partner._create_partner, the following 2 lines are defined:
          partner_id = data.partner_id and data.partner_id.id or False
          return lead.handle_partner_assignation(cr, uid, lead_ids, data.action, partner_id, context=context)

  Since an existing partner was found, 'data.partner_id' exists, thus this will be given as input for the 'handle_partner_assignation' method. This last method defines the following lines:
          force_partner_id = partner_id
          for lead in self.browse(cr, uid, ids, context=context):
              # If the action is set to 'create' and no partner_id is set, create a new one
              if action == 'create':
                  partner_id = force_partner_id or self._create_lead_partner(cr, uid, lead, context)

  Thus, when a partner_id is given, the lead/opportunity is linked to
  it, even when the action is 'create'!

  So as far as I can see, there's 2 errors in the code:
  1) If the 'handle_partner_assignation' method has 'create' as action, it should always do a create, whether the partner_id is given or not.
  2) The '_create_partner' method should check the action, and call 'handle_partner_assignation' with our without partner_id accordingly.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1208436/+subscriptions


References