diff --git a/CHANGELOG b/CHANGELOG index c9295377bc..cb5daf873e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Use required on states for dashboard_layout + Version 1.6.0 - 2010-05-09 * Bug fixes (see mercurial logs for details) diff --git a/res.py b/res.py index 339b212bf5..f3afbec8af 100644 --- a/res.py +++ b/res.py @@ -1,6 +1,7 @@ #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 class User(Model): @@ -12,7 +13,10 @@ class User(Model): ('stack_left', 'Stack Left'), ('stack_top', 'Stack Top'), ('stack_bottom', 'Stack Bottom'), - ], string='Dashboard Layout', required=True) + ], string='Dashboard Layout', + states={ + 'required': True, + }) dashboard_actions = fields.One2Many('dashboard.action', 'user', 'Dashboard Actions') @@ -23,6 +27,13 @@ class User(Model): 'dashboard_actions', ] + def init(self, cursor, module_name): + super(User, self).init(cursor, module_name) + table = TableHandler(cursor, self, module_name) + + # Migration from 1.6 + table.not_null_action('dashboard_layout', action='remove') + def default_dashboard_layout(self, cursor, user, context=None): return 'square'