From cc40e1ff75c5f682cd582b826db0ab92bea1f23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Mar 2011 11:49:34 +0200 Subject: [PATCH 1/2] Add field access on group --- trytond/res/group.py | 2 ++ trytond/res/group.xml | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/trytond/res/group.py b/trytond/res/group.py index 6737ba748d..9f1a362fc0 100644 --- a/trytond/res/group.py +++ b/trytond/res/group.py @@ -33,6 +33,8 @@ class Group(ModelSQL, ModelView): name = fields.Char('Name', required=True, select=1, translate=True) model_access = fields.One2Many('ir.model.access', 'group', 'Access Model') + field_access = fields.One2Many('ir.model.field.access', 'group', + 'Access Field') rule_groups = fields.Many2Many('ir.rule.group-res.group', 'group_id', 'rule_group_id', 'Rules', domain=[('global_p', '!=', True), ('default_p', '!=', True)]) diff --git a/trytond/res/group.xml b/trytond/res/group.xml index a1b05a8a85..5835c0200b 100644 --- a/trytond/res/group.xml +++ b/trytond/res/group.xml @@ -19,13 +19,13 @@ this repository contains the full copyright notices and license terms. --> - - + - - - - + + + + + From 1ccc414413cca33a411e6d087652926e304d079d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 28 Mar 2011 12:52:20 +0200 Subject: [PATCH 2/2] Allow to copy group --- trytond/res/group.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/trytond/res/group.py b/trytond/res/group.py index 6737ba748d..36b0a8a3f6 100644 --- a/trytond/res/group.py +++ b/trytond/res/group.py @@ -45,6 +45,29 @@ class Group(ModelSQL, ModelView): ('name_uniq', 'unique (name)', 'The name of the group must be unique!') ] + def copy(self, ids, default=None): + int_id = isinstance(ids, (int, long)) + if int_id: + ids = [ids] + + if default is None: + default = {} + default = default.copy() + + new_ids = [] + for group in self.browse(ids): + i = 1 + while True: + name = '%s (%d)' % (group.name, i) + if not self.search([('name', '=', name)], order=[]): + break + i += 1 + default['name'] = name + new_ids.append(super(Group, self).copy(group.id, default=default)) + if int_id: + return new_ids[0] + return new_ids + def create(self, vals): res = super(Group, self).create(vals) # Restart the cache on the domain_get method