[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) <xbo@odoo.com>
This commit is contained in:
committed by
Prakash Prajapati
parent
29ce2f0451
commit
2f914d3631
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user