From 2f914d3631a7ffe3bcfc54c5d1d89ae8340f9db8 Mon Sep 17 00:00:00 2001 From: "Manushi Shah (mash)" Date: Tue, 25 Jul 2023 09:13:34 +0000 Subject: [PATCH] [FIX] sale_project: sale order item filter in project sharing Prior to this commit: When we open the portal view of the project which is project sharing and search in a project, we have two different filters for searching sale orders and sale order item which is unnecessary. Hence we can make the search resourceful by combining both filters just like the working of sale order filter in the Search View of the project. Post this commit: Combining both filters under the name sale order to make a seamless search. closes odoo/odoo#131810 Task: 3391908 X-original-commit: fb31cea2aeb666e71f49b4f99813bf592a96d6b2 Signed-off-by: Xavier Bol (xbo) --- addons/sale_project/controllers/portal.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/sale_project/controllers/portal.py b/addons/sale_project/controllers/portal.py index 43cecdfb4a0..b9a3c94b34d 100644 --- a/addons/sale_project/controllers/portal.py +++ b/addons/sale_project/controllers/portal.py @@ -29,16 +29,13 @@ class SaleProjectCustomerPortal(ProjectCustomerPortal): del values['customer'] if not project or project.sudo().allow_billable: values['sale_order'] = {'input': 'sale_order', 'label': _lt('Search in Sales Order'), 'order': 8} - values['sale_line'] = {'input': 'sale_line', 'label': _lt('Search in Sales Order Item'), 'order': 9} values['invoice'] = {'input': 'invoice', 'label': _lt('Search in Invoice'), 'order': 10} return dict(sorted(values.items(), key=lambda item: item[1]["order"])) def _task_get_search_domain(self, search_in, search): search_domain = [super()._task_get_search_domain(search_in, search)] if search_in in ('sale_order', 'all'): - search_domain.append([('sale_order_id.name', 'ilike', search)]) - if search_in in ('sale_line', 'all'): - search_domain.append([('sale_line_id.name', 'ilike', search)]) + search_domain.append(['|', ('sale_order_id.name', 'ilike', search), ('sale_line_id.name', 'ilike', search)]) if search_in in ('invoice', 'all'): search_domain.append([('sale_order_id.invoice_ids.name', 'ilike', search)]) return OR(search_domain)