trytond-party_company/employee.py

24 lines
764 B
Python
Raw Normal View History

2018-07-11 18:33:41 +02:00
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import PoolMeta
2018-07-11 18:33:41 +02:00
from trytond.pyson import Eval, If
from trytond.transaction import Transaction
2018-07-11 18:33:41 +02:00
2018-08-17 18:51:03 +02:00
class Employee(metaclass=PoolMeta):
2018-07-11 18:33:41 +02:00
__name__ = 'company.employee'
@classmethod
def __setup__(cls):
super(Employee, cls).__setup__()
cls.company.domain = [
('id', If(Eval('context', {}).contains('company'), '=', '!='),
Eval('context', {}).get('company', -1)),
]
@classmethod
def read(cls, ids, fields_names=None):
# Skip access rule
with Transaction().set_user(0):
return super(Employee, cls).read(ids, fields_names=fields_names)