Lead to opportunity wizard: partner not created when existing partner found, even when choosing 'create' in the wizard
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP Publisher's Warranty Team |
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_lead2opport
partner_id = data.partner_id and data.partner_id.id or False
return lead.handle_
Since an existing partner was found, 'data.partner_id' exists, thus this will be given as input for the 'handle_
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':
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_
2) The '_create_partner' method should check the action, and call 'handle_
Related branches
- Naresh(OpenERP) (community): Approve
-
Diff: 26 lines (+4/-1)2 files modifiedcrm/wizard/crm_lead_to_opportunity.py (+3/-0)
crm/wizard/crm_lead_to_opportunity_view.xml (+1/-1)
- Yannick Vaucher @ Camptocamp: Disapprove
- Stefan Rijnhart (Opener): Disapprove
- Pedro Manuel Baeza: Needs Information
-
Diff: 93 lines (+20/-5)6 files modifiedcrm/crm_lead.py (+5/-1)
crm/crm_phonecall_view.xml (+3/-3)
crm/wizard/crm_lead_to_opportunity.py (+3/-0)
crm/wizard/crm_lead_to_opportunity_view.xml (+1/-1)
crm/wizard/crm_partner_binding.py (+7/-0)
crm/wizard/crm_phonecall_to_phonecall_view.xml (+1/-0)
Changed in openobject-addons: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
tags: | added: maintenance |
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.