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)
This commit is contained in:
Mohamed Eltayar 2025-11-12 04:07:04 +03:00 committed by GitHub
commit 24d045bd43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 8 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -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',

View File

@ -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"