[MERGE] [FIX] crm: fixed lead to opportunity wizard customer creation policy (opw 596231).

When choosing to link to an existing customer, then changing the action to create
a new customer or to avoid linking, the newly created opportunity was linked
to the previously chosen customer, due to the partner_id field not being
reset and used in the conversion process.

This field is not reset when changing the conversion action, leading to the action
being correctly taken into account.

lp bug: https://launchpad.net/bugs/1208436 fixed

bzr revid: tde@openerp.com-20131129101706-ccsn5u60sw8isroy
This commit is contained in:
Thibault Delavallée 2013-11-29 11:17:06 +01:00
commit d7af813044
2 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,9 @@ class crm_lead2opportunity_partner(osv.osv_memory):
'opportunity_ids': fields.many2many('crm.lead', string='Opportunities'),
}
def onchange_action(self, cr, uid, ids, action, context=None):
return {'value': {'partner_id': False if action != 'exist' else self._find_matching_partner(cr, uid, context=context)}}
def default_get(self, cr, uid, fields, context=None):
"""
Default get for name, opportunity_ids.

View File

@ -27,7 +27,7 @@
</field>
</group>
<group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}">
<field name="action" class="oe_inline"/>
<field name="action" on_change="onchange_action(action, context)" class="oe_inline"/>
<field name="partner_id"
attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"
class="oe_inline"/>