Files
tryton/modules/company_work_time/res.py
T

27 lines
947 B
Python
Raw Normal View History

2014-12-02 12:55:13 +01: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.
2012-09-24 22:17:51 +02:00
from trytond.pool import PoolMeta
2009-05-22 10:51:54 +02:00
2018-06-26 19:11:47 +02:00
class User(metaclass=PoolMeta):
2012-09-24 22:17:51 +02:00
__name__ = 'res.user'
@classmethod
def _get_preferences(cls, user, context_only=False):
res = super(User, cls)._get_preferences(user,
2010-08-10 11:59:03 -04:00
context_only=context_only)
2009-05-22 10:51:54 +02:00
if user.company:
2018-02-11 15:10:00 +01:00
time = {
2015-02-09 23:00:39 +01:00
'h': 60 * 60,
'm': 60,
's': 1,
2018-02-11 15:10:00 +01:00
}
for k, v in [
('Y', user.company.hours_per_work_year),
('M', user.company.hours_per_work_month),
('w', user.company.hours_per_work_week),
('d', user.company.hours_per_work_day)]:
if v:
time[k] = v * 60 * 60
res['company_work_time'] = time
2009-05-22 10:51:54 +02:00
return res