[FIX] sale_crm: correctly handle customer option when converting opportunity

When converting an opportunity to a quotation, it will give 3 options where
the last option is "Do not link to a customer". When clicked it has the
same behavior than "Create a new customer".

Followup of 1d2bccd0db that added the
selection entry but did not implement its behavior.

This commit fixes that behavior. Now it opens a quotation without linked
customer.

Task ID 2065014

closes odoo/odoo#37026

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Florent Lejoly
2019-09-24 11:08:27 +00:00
committed by Thibault Delavallée
parent 1191676227
commit 38d8b0526f
@@ -32,10 +32,11 @@ class Opportunity2Quotation(models.TransientModel):
the freshly created opportunity view.
"""
self.ensure_one()
self.lead_id.write({
'partner_id': self.partner_id.id if self.action == 'exist' else self._create_partner()
})
self.lead_id._onchange_partner_id()
if self.action != 'nothing':
self.lead_id.write({
'partner_id': self.partner_id.id if self.action == 'exist' else self._create_partner()
})
self.lead_id._onchange_partner_id()
return self.lead_id.action_new_quotation()
def _create_partner(self):