diff --git a/auth_dynamic_groups/__init__.py b/auth_dynamic_groups/__init__.py
index 4d083ea93..9da2ac3b6 100644
--- a/auth_dynamic_groups/__init__.py
+++ b/auth_dynamic_groups/__init__.py
@@ -18,4 +18,4 @@
# along with this program. If not, see .
#
##############################################################################
-import model
+from . import model
diff --git a/auth_dynamic_groups/__openerp__.py b/auth_dynamic_groups/__openerp__.py
index e97b5b47f..5ebfa48b4 100644
--- a/auth_dynamic_groups/__openerp__.py
+++ b/auth_dynamic_groups/__openerp__.py
@@ -19,9 +19,9 @@
#
##############################################################################
{
- "name" : "Dynamic groups",
- "version" : "1.0",
- "author" : "Therp BV",
+ "name": "Dynamic groups",
+ "version": "1.0",
+ "author": "Therp BV",
"complexity": "normal",
"description": """
Description
@@ -40,16 +40,16 @@ There is a constraint on the field to check for validity if this expression.
When you're satisfied, click the button `Evaluate` to prefill the group's
members. The condition will be checked now for every user who logs in.
""",
- "category" : "Tools",
- "depends" : [
+ "category": "Tools",
+ "depends": [
'base',
],
- "data" : [
+ "data": [
'view/res_groups.xml',
],
"auto_install": False,
"installable": True,
- "external_dependencies" : {
- 'python' : [],
+ "external_dependencies": {
+ 'python': [],
},
}
diff --git a/auth_dynamic_groups/model/__init__.py b/auth_dynamic_groups/model/__init__.py
index 688da41fd..ad311212d 100644
--- a/auth_dynamic_groups/model/__init__.py
+++ b/auth_dynamic_groups/model/__init__.py
@@ -18,5 +18,5 @@
# along with this program. If not, see .
#
##############################################################################
-import res_users
-import res_groups
+from . import res_users
+from . import res_groups
diff --git a/auth_dynamic_groups/model/res_groups.py b/auth_dynamic_groups/model/res_groups.py
index b484731ce..4becc6cd5 100644
--- a/auth_dynamic_groups/model/res_groups.py
+++ b/auth_dynamic_groups/model/res_groups.py
@@ -29,13 +29,12 @@ class res_groups(Model):
_inherit = 'res.groups'
_columns = {
- 'is_dynamic': fields.boolean('Dynamic'),
- 'dynamic_group_condition': fields.text(
- 'Condition', help='''
- The condition to be met for a user to be a member of this
- group. It is evaluated as python code at login time, you get
- `user' passed as a browse record''')
- }
+ 'is_dynamic': fields.boolean('Dynamic'),
+ 'dynamic_group_condition': fields.text(
+ 'Condition', help='The condition to be met for a user to be a '
+ 'member of this group. It is evaluated as python code at login '
+ 'time, you get `user` passed as a browse record')
+ }
def eval_dynamic_group_condition(self, cr, uid, ids, context=None):
result = True
@@ -43,14 +42,14 @@ class res_groups(Model):
context=context)
for this in self.browse(cr, uid, ids, context=context):
result &= bool(
- safe_eval(
- this.dynamic_group_condition,
- {
- 'user': user,
- 'any': any,
- 'all': all,
- 'filter': filter,
- }))
+ safe_eval(
+ this.dynamic_group_condition,
+ {
+ 'user': user,
+ 'any': any,
+ 'all': all,
+ 'filter': filter,
+ }))
return result
def _check_dynamic_group_condition(self, cr, uid, ids, context=None):
@@ -64,10 +63,10 @@ class res_groups(Model):
return True
_constraints = [
- (_check_dynamic_group_condition,
- 'The condition doesn\'t evaluate correctly!',
- ['dynamic_group_condition']),
- ]
+ (_check_dynamic_group_condition,
+ 'The condition doesn\'t evaluate correctly!',
+ ['dynamic_group_condition']),
+ ]
def action_evaluate(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
diff --git a/auth_dynamic_groups/model/res_users.py b/auth_dynamic_groups/model/res_users.py
index 89109c61c..a1f582421 100644
--- a/auth_dynamic_groups/model/res_users.py
+++ b/auth_dynamic_groups/model/res_users.py
@@ -18,11 +18,10 @@
# along with this program. If not, see .
#
##############################################################################
-import logging
from openerp.osv.orm import Model
-from openerp.osv import fields
from openerp import pooler, SUPERUSER_ID
+
class res_users(Model):
_inherit = 'res.users'
@@ -40,14 +39,16 @@ class res_users(Model):
user = pool.get('res.users').browse(cr, SUPERUSER_ID, uid)
groups_obj = pool.get('res.groups')
user.write(
- {
- 'groups_id': [(4, dynamic_group.id)
- if dynamic_group.eval_dynamic_group_condition()
- else (3, dynamic_group.id)
- for dynamic_group in groups_obj.browse(
- cr, uid,
- groups_obj.search(cr, uid,
- [('is_dynamic', '=', True)]))]
- })
+ {
+ 'groups_id': [
+ (4, dynamic_group.id)
+ if dynamic_group.eval_dynamic_group_condition()
+ else (3, dynamic_group.id)
+ for dynamic_group in groups_obj.browse(
+ cr, uid,
+ groups_obj.search(cr, uid,
+ [('is_dynamic', '=', True)]))
+ ],
+ })
cr.commit()
cr.close()