Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
00aaad63 by Cédric Krier at 2023-04-05T18:33:38+02:00
Do not fail to set button state if there is no record
The readonly attribute of record must only be used if there is actually a
record.
Closes #12189
- - - - -
2 changed files:
- sao/src/common.js
- tryton/tryton/common/button.py
Changes:
=====================================
sao/src/common.js
=====================================
@@ -932,7 +932,8 @@
this.el.show();
}
this.el.prop(
- 'disabled', record.readonly || Boolean(states.readonly));
+ 'disabled',
+ (record? record.readonly : false) || Boolean(states.readonly));
this.set_icon(states.icon || this.attributes.icon);
if (this.attributes.rule) {
=====================================
tryton/tryton/common/button.py
=====================================
@@ -38,7 +38,8 @@
else:
self.show()
self.set_sensitive(
- not record.readonly and not states.get('readonly', False))
+ not (record.readonly if record else False)
+ and not states.get('readonly', False))
self._set_icon(states.get('icon', self.attrs.get('icon')))
if self.attrs.get('rule'):
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/00aaad6347ca16fb912c17506fd13fba151938ad
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/00aaad6347ca16fb912c17506fd13fba151938ad
You're receiving this email because of your account on foss.heptapod.net.