[IMP] hr_luncheon_voucher: search of Luncheon Voucher

add search by employee and distrib_campaign_name, whatever the company
This commit is contained in:
clementthomas
2023-04-17 15:13:00 +02:00
parent c7f2d0683b
commit 0538e04997
2 changed files with 12 additions and 1 deletions

View File

@@ -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)

View File

@@ -7,6 +7,8 @@
<field name="arch" type="xml">
<search string="Luncheon vouchers allocations">
<field name="state" />
<field name="employee_id" context="{'search_all_campanies':True}" />
<field name="distrib_campaign_name" />
<filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" />
<filter name="confirmed" string="Confirmed" domain="[('state', '=', 'confirmed')]" />
<filter name="distributed" string="Distributed"