1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#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 Model, fields
from trytond.backend import TableHandler
from trytond.transaction import Transaction
class User(Model):
_name = "res.user"
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')
dashboard_actions = fields.One2Many('dashboard.action', 'user',
'Dashboard Actions')
def __init__(self):
super(User, self).__init__()
self._preferences_fields += [
'dashboard_layout',
'dashboard_actions',
]
def init(self, module_name):
super(User, self).init(module_name)
cursor = Transaction().cursor
table = TableHandler(cursor, self, module_name)
# Migration from 1.6
table.not_null_action('dashboard_layout', action='remove')
def default_dashboard_layout(self):
return 'square'
User()
|