Commit 4987965e authored by Santiago Apel's avatar Santiago Apel 💬
Browse files

[IMP] search and get_name union_membership

parent 75cb678e
......@@ -8,7 +8,7 @@ _logger = logging.getLogger(__name__)
class HREmployee(models.Model):
_inherit = "hr.employee"
@api.depends('contract_ids','contract_ids.state','contract_ids.date_start','contract_ids.date_end')
@api.depends('contract_ids','contract_ids.state','contract_ids.date_start','contract_ids.date_end','contract_ids.active')
def _get_vigent_contract(self):
for record in self:
contract_ids = self.env["hr.contract"].search(
......
# -*- encoding: utf-8 -*-
from openerp import fields, models
from openerp import fields, models , api
class HRUnionMembership(models.Model):
_name = 'hr.union.membership'
name = fields.Char(string="Name")
code = fields.Char('Code')
@api.multi
def name_get(self):
res = []
for rec in self:
name = ''
if rec.name and rec.code:
name = f'{rec.code} - {rec.name}'
elif rec.name:
name = f'{rec.name}'
elif rec.code:
name = f'{rec.code}'
res.append((rec.id, name))
return res
@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
if args is None:
args = []
print(name)
print(args)
if name:
args += ['|', ('code', 'ilike', name), ('name', 'ilike', name)]
name = ''
return super(HRUnionMembership, self).name_search(
name=name, args=args, operator=operator, limit=limit
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment