Files
tryton/modules/dashboard/res.py
T

41 lines
1.3 KiB
Python
Raw Normal View History

2014-12-02 12:55:19 +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.
from trytond.model import ModelView, fields
from trytond.pool import Pool, PoolMeta
2012-09-24 22:17:54 +02:00
2009-12-23 00:04:42 +01:00
2018-06-26 19:11:47 +02:00
class User(metaclass=PoolMeta):
2012-09-24 22:17:54 +02:00
__name__ = "res.user"
2009-12-23 00:04:42 +01:00
dashboard_layout = fields.Selection([
('square', 'Square'),
('stack_right', 'Stack Right'),
('stack_left', 'Stack Left'),
('stack_top', 'Stack Top'),
('stack_bottom', 'Stack Bottom'),
], string='Dashboard Layout')
2009-12-23 00:04:42 +01:00
dashboard_actions = fields.One2Many('dashboard.action', 'user',
'Dashboard Actions')
2012-09-24 22:17:54 +02:00
@classmethod
def __setup__(cls):
super(User, cls).__setup__()
cls._preferences_fields += [
2009-12-23 00:04:42 +01:00
'dashboard_layout',
'dashboard_actions',
2012-09-24 22:17:54 +02:00
]
2009-12-23 00:04:42 +01:00
2012-09-24 22:17:54 +02:00
@staticmethod
def default_dashboard_layout():
2009-12-23 00:04:42 +01:00
return 'square'
@classmethod
def write(cls, *args):
pool = Pool()
View = pool.get('ir.ui.view')
super().write(*args)
for values in args[1:None:2]:
if values.keys() & {'dashboard_layout', 'dashboard_actions'}:
View._view_get_cache.clear()
ModelView._fields_view_get_cache.clear()
break