From 1769e45d74fa2fa7d904cee6bcc172ce29890ffe Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 24 Sep 2020 10:05:25 +0000 Subject: [PATCH] [FIX] sale_crm: Default tag_id used when confirming order Steps to reproduce the bug: - Let's consider a service product P with Service Tracking = 'Create a task in an existing project' and Project = PT - Create a lead L and set a tag T on it - Mark L as won and create a new quotation Q from L - Add P on Q and confirm it Bug: An error was raised because the tag T didn't exsit on model project.task PS: Confirming an order can trigger the creation of many records in different models and the generic field tag_ids is defined on many models. So keeping it in the context when confirming an order can lead to many issues. opw:2338764 closes odoo/odoo#58455 X-original-commit: 61a55aabaa46b002b7a4afb6335ab879026c740b Signed-off-by: Simon Goffin (sig) Signed-off-by: Christophe Monniez (moc) --- addons/sale_crm/models/sale_order.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale_crm/models/sale_order.py b/addons/sale_crm/models/sale_order.py index 81ce2154f4a..50a97d196ab 100644 --- a/addons/sale_crm/models/sale_order.py +++ b/addons/sale_crm/models/sale_order.py @@ -10,3 +10,6 @@ class SaleOrder(models.Model): opportunity_id = fields.Many2one( 'crm.lead', string='Opportunity', check_company=True, domain="[('type', '=', 'opportunity'), '|', ('company_id', '=', False), ('company_id', '=', company_id)]") + + def action_confirm(self): + return super(SaleOrder, self.with_context({k:v for k,v in self._context.items() if k != 'default_tag_ids'})).action_confirm()