From c14ed3b562a079936468aa66ea2c738b5598f5ad Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Wed, 3 Apr 2019 16:29:09 +0200 Subject: [PATCH] [9.0][FIX] base_techical_features: Don't load all users if not needed Odoo ORM will load all users contained in loaded group in cache. That has huge performances impact if there is a lot of users in that group (especially in computed fields). --- base_technical_features/__openerp__.py | 2 +- base_technical_features/models/res_users.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/base_technical_features/__openerp__.py b/base_technical_features/__openerp__.py index 14383e9f5..c7b867c6a 100644 --- a/base_technical_features/__openerp__.py +++ b/base_technical_features/__openerp__.py @@ -4,7 +4,7 @@ { "name": "Technical features group", "summary": "Access to technical features without activating debug mode", - "version": "9.0.1.0.0", + "version": "9.0.1.0.1", "category": "Usability", "website": "https://github.com/oca/server-tools", "author": "Opener B.V., Odoo Community Association (OCA)", diff --git a/base_technical_features/models/res_users.py b/base_technical_features/models/res_users.py index 824caefac..78a455806 100644 --- a/base_technical_features/models/res_users.py +++ b/base_technical_features/models/res_users.py @@ -23,18 +23,16 @@ class ResUsers(models.Model): def get_show_technical_features(self): """ Only display the technical features checkbox in the user preferences if the user has access to them """ - users = self.env.ref('base.group_no_one').users 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.depends('groups_id') def get_technical_features(self): """ Map user membership to boolean field value """ - users = self.env.ref( - 'base_technical_features.group_technical_features').users for user in self: - user.technical_features = user in users + user.technical_features = user.has_group( + 'base_technical_features.group_technical_features') @api.multi def set_technical_features(self):