Hide buttons and links when there is no record

There is no action to run without a record.

Closes #14250
This commit is contained in:
Cédric Krier committed 2025-09-23 11:35:23 +02:00
1 parent 63ef97ca4f
commit 457adf3ebc
4 files changed
+6 -2

No files matched your search

+1 -1
View File
@@ -959,7 +959,7 @@
if (record) {
states = record.expr_eval(this.attributes.states || {});
} else {
states = {};
states = {'invisible': true};
}
if (states.invisible) {
this.el.hide();
+2
View File
@@ -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');
+1 -1
View File
@@ -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:
@@ -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)