From d39bfa8906e868a9a60b15f2ba13255392cd1e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 23 Oct 2014 20:31:03 +0200 Subject: [PATCH] Show 'Translate view' plugin to granted users only Only users with read and write access on translation should have access to the plugin. issue4250 review13611002 --- tryton/plugins/translation/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tryton/plugins/translation/__init__.py b/tryton/plugins/translation/__init__.py index d88cf6e0b3..eb3d25690c 100644 --- a/tryton/plugins/translation/__init__.py +++ b/tryton/plugins/translation/__init__.py @@ -1,8 +1,10 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. -from tryton.gui.window import Window import gettext +from tryton.gui.window import Window +from tryton.common import MODELACCESS + _ = gettext.gettext @@ -14,6 +16,10 @@ def translate_view(datas): def get_plugins(model): - return [ - (_('Translate view'), translate_view), - ] + access = MODELACCESS['ir.translation'] + if access['read'] and access['write']: + return [ + (_('Translate view'), translate_view), + ] + else: + return []