diff --git a/sao/src/common.js b/sao/src/common.js index e7cd7cb9ad..6726880abd 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -959,7 +959,7 @@ if (record) { states = record.expr_eval(this.attributes.states || {}); } else { - states = {}; + states = {'invisible': true}; } if (states.invisible) { this.el.hide(); diff --git a/sao/src/view/form.js b/sao/src/view/form.js index cc5fa8c950..4268f4d22f 100644 --- a/sao/src/view/form.js +++ b/sao/src/view/form.js @@ -1091,6 +1091,8 @@ function eval_pyson(value){ this._current = record.id; } else { this._current = null; + this.el.hide(); + return; } pyson_ctx.context = context; this.el.off('click'); diff --git a/tryton/tryton/common/button.py b/tryton/tryton/common/button.py index d6a9a8b4ef..945902601c 100644 --- a/tryton/tryton/common/button.py +++ b/tryton/tryton/common/button.py @@ -32,7 +32,7 @@ class Button(Gtk.Button): if record: states = record.expr_eval(self.attrs.get('states', {})) else: - states = {} + states = {'invisible': True} if states.get('invisible', False): self.hide() else: diff --git a/tryton/tryton/gui/window/view_form/view/form_gtk/state_widget.py b/tryton/tryton/gui/window/view_form/view/form_gtk/state_widget.py index f3ffb9bcba..37bf2cef1f 100644 --- a/tryton/tryton/gui/window/view_form/view/form_gtk/state_widget.py +++ b/tryton/tryton/gui/window/view_form/view/form_gtk/state_widget.py @@ -155,6 +155,8 @@ class Link(StateMixin, Gtk.Button): context = {} pyson_ctx = {} self._current = None + self.hide() + return pyson_ctx['context'] = context try: self.disconnect_by_func(self.__class__.clicked)