[IMP] ir.ui.view: call _update_user_groups_view() once per install

This saves 1.5% of the total installation time.

X-original-commit: afd39e1a9824252d13823e484c60ad813b9b51a6
This commit is contained in:
Raphael Collet
2020-04-03 11:40:30 +00:00
parent a233d534c2
commit 8a3e1a0ccd
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -18,6 +18,7 @@ from lxml.builder import E
import passlib.context
from odoo import api, fields, models, tools, SUPERUSER_ID, _
from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG
from odoo.exceptions import AccessDenied, AccessError, UserError, ValidationError
from odoo.http import request
from odoo.osv import expression
@@ -1085,6 +1086,10 @@ class GroupsView(models.Model):
""" Modify the view with xmlid ``base.user_groups_view``, which inherits
the user form view, and introduces the reified group fields.
"""
if self._context.get('install_filename') or self._context.get(MODULE_UNINSTALL_FLAG):
# skip now; it will be updated once at the end of (un)installation
return
# remove the language to avoid translations, it will be handled at the view level
self = self.with_context(lang=None)
+1
View File
@@ -527,6 +527,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
# STEP 6: verify custom views on every model
if update_module:
env = api.Environment(cr, SUPERUSER_ID, {})
env['res.groups']._update_user_groups_view()
View = env['ir.ui.view']
for model in registry:
try: