Files
tryton/timesheet.py
T

19 lines
639 B
Python
Raw Normal View History

2016-06-30 22:00:28 +02:00
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta, Pool
2020-03-01 12:33:53 +01:00
class Work(metaclass=PoolMeta):
2016-06-30 22:00:28 +02:00
__name__ = 'timesheet.work'
@classmethod
def _get_origin(cls):
2020-03-01 12:33:53 +01:00
return super()._get_origin() + ['production.work']
2016-06-30 22:00:28 +02:00
def _validate_company(self):
pool = Pool()
ProductionWork = pool.get('production.work')
2020-03-01 12:33:53 +01:00
result = super()._validate_company()
2016-06-30 22:00:28 +02:00
if isinstance(self.origin, ProductionWork):
result &= self.company == self.origin.company
return result