From 89b10c172e4c1c8da5cb01beac954f51372f194f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 28 Feb 2008 17:44:23 +0100 Subject: [PATCH] Move group stuff to its own file --- trytond/res/__init__.py | 1 + trytond/res/__tryton__.py | 1 + trytond/res/group.py | 28 ++++++++++++++ trytond/res/group.xml | 80 +++++++++++++++++++++++++++++++++++++++ trytond/res/user.py | 31 ++------------- trytond/res/user.xml | 75 ------------------------------------ 6 files changed, 113 insertions(+), 103 deletions(-) create mode 100644 trytond/res/group.py create mode 100644 trytond/res/group.xml diff --git a/trytond/res/__init__.py b/trytond/res/__init__.py index 8f15df49ef..92ce8ba2d5 100644 --- a/trytond/res/__init__.py +++ b/trytond/res/__init__.py @@ -1,2 +1,3 @@ +from group import * from user import * from request import * diff --git a/trytond/res/__tryton__.py b/trytond/res/__tryton__.py index 8d8bb82f04..f98e131972 100644 --- a/trytond/res/__tryton__.py +++ b/trytond/res/__tryton__.py @@ -4,6 +4,7 @@ 'depends': ['ir'], 'xml': [ 'res.xml', + 'group.xml', 'user.xml', 'request.xml', 'ir.xml', diff --git a/trytond/res/group.py b/trytond/res/group.py new file mode 100644 index 0000000000..7453738299 --- /dev/null +++ b/trytond/res/group.py @@ -0,0 +1,28 @@ +"Group" +from trytond.osv import fields, OSV + + +class Group(OSV): + "Group" + _name = "res.group" + _description = __doc__ + name = fields.Char('Group Name', size=64, required=True) + model_access = fields.One2Many('ir.model.access', 'group', + 'Access Controls') + rule_groups = fields.Many2Many('ir.rule.group', 'group_rule_group_rel', + 'group_id', 'rule_group_id', 'Rules', + domain="[('global', '<>', True)]") + menu_access = fields.Many2Many('ir.ui.menu', 'ir_ui_menu_group_rel', + 'gid', 'menu_id', 'Access Menu') + _sql_constraints = [ + ('name_uniq', 'unique (name)', 'The name of the group must be unique!') + ] + + def write(self, cursor, user, ids, vals, context=None): + res = super(Group, self).write(cursor, user, ids, vals, + context=context) + # Restart the cache on the domain_get method + self.pool.get('ir.rule').domain_get() + return res + +Group() diff --git a/trytond/res/group.xml b/trytond/res/group.xml new file mode 100644 index 0000000000..59acacc070 --- /dev/null +++ b/trytond/res/group.xml @@ -0,0 +1,80 @@ + + + + + admin + + + res.group + form + + + + + + + + + + + + + + + + ]]> + + + + res.group + tree + + + + + ]]> + + + + Groups + ir.action.act_window + res.group + form + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trytond/res/user.py b/trytond/res/user.py index ee65c600f2..4a94b9dcb1 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -8,32 +8,6 @@ from trytond.osv import fields, OSV, ExceptOSV from trytond.wizard import Wizard, WizardOSV -class Group(OSV): - "Group" - _name = "res.group" - _description = __doc__ - name = fields.Char('Group Name', size=64, required=True) - model_access = fields.One2Many('ir.model.access', 'group', - 'Access Controls') - rule_groups = fields.Many2Many('ir.rule.group', 'group_rule_group_rel', - 'group_id', 'rule_group_id', 'Rules', - domain="[('global', '<>', True)]") - menu_access = fields.Many2Many('ir.ui.menu', 'ir_ui_menu_group_rel', - 'gid', 'menu_id', 'Access Menu') - _sql_constraints = [ - ('name_uniq', 'unique (name)', 'The name of the group must be unique!') - ] - - def write(self, cursor, user, ids, vals, context=None): - res = super(Group, self).write(cursor, user, ids, vals, - context=context) - # Restart the cache on the domain_get method - self.pool.get('ir.rule').domain_get() - return res - -Group() - - class User(OSV): "User" _name = "res.user" @@ -225,11 +199,12 @@ class User(OSV): User() -class Group2(Group): +class Group(OSV): + _name = 'res.group' users = fields.many2many( 'res.user', 'res_group_user_rel', 'gid', 'uid', 'Users') -Group2() +Group() class UserConfigInit(WizardOSV): diff --git a/trytond/res/user.xml b/trytond/res/user.xml index f8d8656b8d..a3d2c699fb 100644 --- a/trytond/res/user.xml +++ b/trytond/res/user.xml @@ -1,9 +1,6 @@ - - admin - admin admin @@ -106,78 +103,6 @@ - - res.group - form - - - - - - - - - - - - - - - - ]]> - - - - res.group - tree - - - - - ]]> - - - - Groups - ir.action.act_window - res.group - form - - - - - - - - - - - - - - - - - - - - - - - - - - - res.user.config.init form