From 0538e04997a990791a91b8e94146da5bbbf86fa5 Mon Sep 17 00:00:00 2001 From: clementthomas Date: Mon, 17 Apr 2023 15:13:00 +0200 Subject: [PATCH] [IMP] hr_luncheon_voucher: search of Luncheon Voucher add search by employee and distrib_campaign_name, whatever the company --- hr_luncheon_voucher/models/hr_employee.py | 11 ++++++++++- hr_luncheon_voucher/views/hr_lv_allocation_views.xml | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hr_luncheon_voucher/models/hr_employee.py b/hr_luncheon_voucher/models/hr_employee.py index 81cb5d9..857c089 100644 --- a/hr_luncheon_voucher/models/hr_employee.py +++ b/hr_luncheon_voucher/models/hr_employee.py @@ -1,5 +1,5 @@ from xml.dom.minicompat import EmptyNodeList -from odoo import fields, models +from odoo import fields, models, api class HrEmployeeBase(models.AbstractModel): @@ -72,3 +72,12 @@ class HrEmployeeBase(models.AbstractModel): ctx["active_ids"] = self.ids action["context"] = ctx return action + + @api.model + def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None): + """ + On lv allocation, allow employee search on all companies + """ + if self.env.context.get('search_all_campanies'): + return super(HrEmployeeBase, self.sudo())._name_search(name, args, operator, limit, name_get_uid) + return super(HrEmployeeBase, self)._name_search(name, args, operator, limit, name_get_uid) \ No newline at end of file diff --git a/hr_luncheon_voucher/views/hr_lv_allocation_views.xml b/hr_luncheon_voucher/views/hr_lv_allocation_views.xml index 3f6ede8..ca2476c 100644 --- a/hr_luncheon_voucher/views/hr_lv_allocation_views.xml +++ b/hr_luncheon_voucher/views/hr_lv_allocation_views.xml @@ -7,6 +7,8 @@ + +