From 38d8b0526f0fccc32df5a11f5d086a3522ed5fcf Mon Sep 17 00:00:00 2001 From: Florent Lejoly Date: Tue, 17 Sep 2019 13:57:34 +0000 Subject: [PATCH] [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 1d2bccd0dbd2770e0625a26b66a8b48c954b2c86 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) --- addons/sale_crm/wizard/crm_opportunity_to_quotation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/sale_crm/wizard/crm_opportunity_to_quotation.py b/addons/sale_crm/wizard/crm_opportunity_to_quotation.py index 5bb95af10b7..de85076251f 100644 --- a/addons/sale_crm/wizard/crm_opportunity_to_quotation.py +++ b/addons/sale_crm/wizard/crm_opportunity_to_quotation.py @@ -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):