Merge pull request #5369 from expsa/fix/ui-buttons-readonly-menu-icon-20251112-040000
fix: Disable UI Buttons in Readonly Mode - 20251112
This commit is contained in:
commit
ea823f2806
|
|
@ -205,11 +205,40 @@
|
|||
|
||||
_setupSimpleUI: function () {
|
||||
var self = this;
|
||||
var currentData = self.model.localData[self.handle].data;
|
||||
var isReadonly = currentData.state !== 'draft' || self.mode === 'readonly';
|
||||
|
||||
// Remove old event handlers to prevent duplicates
|
||||
this.$('.record_option').off('click');
|
||||
this.$('.mechanism_option').off('click');
|
||||
|
||||
// Disable buttons if readonly
|
||||
if (isReadonly) {
|
||||
this.$('.record_option').css({
|
||||
'pointer-events': 'none',
|
||||
'opacity': '0.6',
|
||||
'cursor': 'not-allowed'
|
||||
});
|
||||
this.$('.mechanism_option').css({
|
||||
'pointer-events': 'none',
|
||||
'opacity': '0.6',
|
||||
'cursor': 'not-allowed'
|
||||
});
|
||||
return; // Don't attach click handlers if readonly
|
||||
} else {
|
||||
// Re-enable buttons if not readonly
|
||||
this.$('.record_option').css({
|
||||
'pointer-events': 'auto',
|
||||
'opacity': '1',
|
||||
'cursor': 'pointer'
|
||||
});
|
||||
this.$('.mechanism_option').css({
|
||||
'pointer-events': 'auto',
|
||||
'opacity': '1',
|
||||
'cursor': 'pointer'
|
||||
});
|
||||
}
|
||||
|
||||
// Record Type Options - Odoo 14 Compatible Method
|
||||
this.$('.record_option').on('click', function () {
|
||||
var $option = $(this);
|
||||
|
|
|
|||
Loading…
Reference in New Issue