Remove context from keyword cache

The cached values depend only on the language and the groups of the user.
This commit is contained in:
Cédric Krier
2023-09-22 15:26:54 +02:00
parent 09b9d5b2f0
commit 013c746067
+3 -2
View File
@@ -165,7 +165,8 @@ class ActionKeyword(ModelSQL, ModelView):
model = fields.Reference('Model', selection='models_get')
action = fields.Many2One('ir.action', 'Action',
ondelete='CASCADE')
_get_keyword_cache = Cache('ir_action_keyword.get_keyword')
_get_keyword_cache = Cache(
'ir_action_keyword.get_keyword', context=False)
@classmethod
def __setup__(cls):
@@ -259,7 +260,7 @@ class ActionKeyword(ModelSQL, ModelView):
ModelAccess = pool.get('ir.model.access')
User = pool.get('res.user')
groups = User.get_groups()
key = (groups, keyword, tuple(value))
key = (Transaction().language, groups, keyword, tuple(value))
keywords = cls._get_keyword_cache.get(key)
if keywords is not None:
return keywords