[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) <sig@openerp.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
Goffin Simon
2020-09-24 15:51:19 +00:00
parent 7ecb903bea
commit 1769e45d74
+3
View File
@@ -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()