Merge pull request #5371 from expsa/fix/ui-buttons-draft-state-only-20251112-050000
fix: Correct UI Buttons Logic - Draft State Only (Fixes PR #5369)
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
|
@ -206,14 +206,16 @@
|
|||
_setupSimpleUI: function () {
|
||||
var self = this;
|
||||
var currentData = self.model.localData[self.handle].data;
|
||||
var isReadonly = currentData.state !== 'draft' || self.mode === 'readonly';
|
||||
// CRITICAL: Buttons are ONLY editable in 'draft' state
|
||||
// Even if user clicks "Edit", buttons remain readonly if state != 'draft'
|
||||
var isDraftState = currentData.state === 'draft';
|
||||
|
||||
// Remove old event handlers to prevent duplicates
|
||||
this.$('.record_option').off('click');
|
||||
this.$('.mechanism_option').off('click');
|
||||
|
||||
// Disable buttons if readonly
|
||||
if (isReadonly) {
|
||||
// Disable buttons if NOT in draft state (regardless of form mode)
|
||||
if (!isDraftState) {
|
||||
this.$('.record_option').css({
|
||||
'pointer-events': 'none',
|
||||
'opacity': '0.6',
|
||||
|
|
@ -224,9 +226,9 @@
|
|||
'opacity': '0.6',
|
||||
'cursor': 'not-allowed'
|
||||
});
|
||||
return; // Don't attach click handlers if readonly
|
||||
return; // Don't attach click handlers if not draft
|
||||
} else {
|
||||
// Re-enable buttons if not readonly
|
||||
// Enable buttons ONLY in draft state
|
||||
this.$('.record_option').css({
|
||||
'pointer-events': 'auto',
|
||||
'opacity': '1',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon5.png" groups="odex_takaful.group_kufula_user"/>
|
||||
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon.png" groups="odex_takaful.group_kufula_user"/>
|
||||
|
||||
<!-- Main Kafalat-->
|
||||
<menuitem id="kafalat_main_menu" parent="takaful_kufula_app_top_menu"
|
||||
|
|
|
|||