changeset b57d19ac7494 in sao:5.4
details: https://hg.tryton.org/sao?cmd=changeset;node=b57d19ac7494
description:
        Disable menu button when user has no access right

        Since rev c2b74d2ff7ed, the variable name does not contains the button 
name so
        the test for menu_buttons always fails.

        issue9528
        review310221002
        (grafted from aa38a1d3a92226fa2a65f43191af71c3117680bf)
diffstat:

 src/tab.js |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b072c0cb0d59 -r b57d19ac7494 src/tab.js
--- a/src/tab.js        Mon Aug 03 00:03:15 2020 +0200
+++ b/src/tab.js        Sun Aug 16 16:32:59 2020 +0200
@@ -993,10 +993,10 @@
                 ['copy', access.create],
                 ['import', access.create],
                 ].forEach(function(e) {
-                    var button = e[0];
+                    var name = e[0];
                     var access = e[1];
-                    if (this.buttons[button]) {
-                        this.buttons[button].toggleClass('disabled', !access);
+                    if (this.buttons[name]) {
+                        this.buttons[name].toggleClass('disabled', !access);
                     }
                     if (this.menu_buttons[name]) {
                         this.menu_buttons[name]
@@ -1324,6 +1324,9 @@
             }.bind(this));
         },
         import: function(){
+            if (!Sao.common.MODELACCESS.get(this.screen.model_name).create) {
+                return;
+            }
             new Sao.Window.Import(this.title.text(), this.screen);
         },
         get_url: function() {

Reply via email to