[FIX] sale_project: filter on tasks linked to the sale

In the case where we have multiple projects, we also want to filter on
tasks linked to the SO. In the current implmementation, the default sale
order passed in the context is used to filter by name which results in
including tasks where name of the SO contains the name of the SO instead
of being equal.

opw-3499181

closes odoo/odoo#136895

X-original-commit: f24dc0b681db398755dcd5656c707273d3d72ef4
Signed-off-by: Audric Onockx (auon) <auon@odoo.com>
This commit is contained in:
Krzysztof Magusiak
2023-09-29 09:21:53 +00:00
committed by Audric Onockx (auon)
parent 82ba5791f0
commit 569fdb3028
+3
View File
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import ast
from collections import defaultdict
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools.safe_eval import safe_eval
from odoo.osv.expression import AND
class SaleOrder(models.Model):
@@ -129,6 +131,7 @@ class SaleOrder(models.Model):
'default_project_id': default_project_id,
'default_user_ids': [self.env.uid],
}
action['domain'] = AND([ast.literal_eval(action['domain']), [('id', 'in', self.tasks_ids.ids)]])
return action
def action_create_project(self):