Browse Source
Merge pull request #1544 from acsone/9.0-fix-base_techical_features_cache-dro
[9.0][FIX] base_techical_features: Don't load all users if not needed
9.0
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
6 deletions
-
base_technical_features/__openerp__.py
-
base_technical_features/models/res_users.py
|
@ -4,7 +4,7 @@ |
|
|
{ |
|
|
{ |
|
|
"name": "Technical features group", |
|
|
"name": "Technical features group", |
|
|
"summary": "Access to technical features without activating debug mode", |
|
|
"summary": "Access to technical features without activating debug mode", |
|
|
"version": "9.0.1.0.0", |
|
|
|
|
|
|
|
|
"version": "9.0.1.0.1", |
|
|
"category": "Usability", |
|
|
"category": "Usability", |
|
|
"website": "https://github.com/oca/server-tools", |
|
|
"website": "https://github.com/oca/server-tools", |
|
|
"author": "Opener B.V., Odoo Community Association (OCA)", |
|
|
"author": "Opener B.V., Odoo Community Association (OCA)", |
|
|
|
@ -23,18 +23,16 @@ class ResUsers(models.Model): |
|
|
def get_show_technical_features(self): |
|
|
def get_show_technical_features(self): |
|
|
""" Only display the technical features checkbox in the user |
|
|
""" Only display the technical features checkbox in the user |
|
|
preferences if the user has access to them """ |
|
|
preferences if the user has access to them """ |
|
|
users = self.env.ref('base.group_no_one').users |
|
|
|
|
|
for user in self: |
|
|
for user in self: |
|
|
user.show_technical_features = user in users |
|
|
|
|
|
|
|
|
user.show_technical_features = user.has_group('base.group_no_one') |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
@api.depends('groups_id') |
|
|
@api.depends('groups_id') |
|
|
def get_technical_features(self): |
|
|
def get_technical_features(self): |
|
|
""" Map user membership to boolean field value """ |
|
|
""" Map user membership to boolean field value """ |
|
|
users = self.env.ref( |
|
|
|
|
|
'base_technical_features.group_technical_features').users |
|
|
|
|
|
for user in self: |
|
|
for user in self: |
|
|
user.technical_features = user in users |
|
|
|
|
|
|
|
|
user.technical_features = user.has_group( |
|
|
|
|
|
'base_technical_features.group_technical_features') |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def set_technical_features(self): |
|
|
def set_technical_features(self): |
|
|