Merge lp:~openerp-dev/openobject-addons/7.0-opw-596231-rgo into lp:openobject-addons/7.0

Proposed by Ravi Gohil (OpenERP)
Status: Merged
Approved by: Naresh(OpenERP)
Approved revision: no longer in the source branch.
Merged at revision: 9664
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-596231-rgo
Merge into: lp:openobject-addons/7.0
Diff against target: 26 lines (+4/-1)
2 files modified
crm/wizard/crm_lead_to_opportunity.py (+3/-0)
crm/wizard/crm_lead_to_opportunity_view.xml (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-596231-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+179859@code.launchpad.net

Description of the change

Steps to reproduce:
1) Create a record for lead, select a customer(onchange partner will set it's related fields),
2) Remove the value for that customer and save it,
3) Launch the "Convert to Opportunity" wizard and choose any option other than 'Link to an existing customer' and create opportunity.

Result Expected:
If "Create a new customer" was selected, it should create a new customer and link it to the opportunity and if "Do not link to a customer" was selected, it should have created the opportunity with no customer selected.

Current Result:
Once the system suggested any existing partner to link with, it does not serve the expected result for options "Create a new customer" and "Do not link to a customer" and always link the suggested partner to that opportunity.

Issue is caused as once the system suggested partner was set in the wizard and when the other options selected it simply just hid the partner field and never cleared it's value which then going to be passed to _create_partner(...) and result into this bug.

I have fixed it by clearing the partner by mean of an onchange on the action field.

Kindly review the fix.

Thanks.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'crm/wizard/crm_lead_to_opportunity.py'
2--- crm/wizard/crm_lead_to_opportunity.py 2013-06-07 11:38:29 +0000
3+++ crm/wizard/crm_lead_to_opportunity.py 2013-08-13 07:16:36 +0000
4@@ -37,6 +37,9 @@
5 'opportunity_ids': fields.many2many('crm.lead', string='Opportunities'),
6 }
7
8+ def onchange_action(self, cr, uid, ids, action, context=None):
9+ return {'value': {'partner_id': False if action != 'exist' else self._find_matching_partner(cr, uid, context=context)}}
10+
11 def default_get(self, cr, uid, fields, context=None):
12 """
13 Default get for name, opportunity_ids.
14
15=== modified file 'crm/wizard/crm_lead_to_opportunity_view.xml'
16--- crm/wizard/crm_lead_to_opportunity_view.xml 2013-02-08 10:47:13 +0000
17+++ crm/wizard/crm_lead_to_opportunity_view.xml 2013-08-13 07:16:36 +0000
18@@ -27,7 +27,7 @@
19 </field>
20 </group>
21 <group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}">
22- <field name="action" class="oe_inline"/>
23+ <field name="action" on_change="onchange_action(action, context)" class="oe_inline"/>
24 <field name="partner_id"
25 attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"
26 class="oe_inline"/>