From 569fdb30283fb5c01220445a893fe77e26362b31 Mon Sep 17 00:00:00 2001 From: Krzysztof Magusiak Date: Mon, 18 Sep 2023 10:21:45 +0000 Subject: [PATCH] [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) --- addons/sale_project/models/sale_order.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale_project/models/sale_order.py b/addons/sale_project/models/sale_order.py index 82de63ca2c2..254162b38cd 100644 --- a/addons/sale_project/models/sale_order.py +++ b/addons/sale_project/models/sale_order.py @@ -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):