← 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

 

Hi,

Thanks for the clear description, it helped reproduce the issue quickly.

However, the root cause of the issue lies in the wizard itself, i.e.
once the wizard set the automatically suggested partner in partner field
and when one selected the other options than "Link to an existing
customer", it just hid the partner field but never cleared the value of
it, and thus, the partner value always going to be there in
data(_create_partner(...)) and hence resulting into this bug.

So, it is better to fix the issue by clearing the partner when the
wizard tells not to link the opportunity to an existing partner. This
can be done by introducing an onchange(...) on the "action" field.

I will soon create a branch with the fix and link it to this bug.

Thanks.

** Changed in: openobject-addons
       Status: New => In Progress

** Changed in: openobject-addons
   Importance: Undecided => Low

-- 
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):
  In Progress

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