fix: buttons editable on new record & compact code badge

- Removed form mode check - buttons now editable in draft state
- Moved code badge to top-right corner (absolute positioning)
- Smaller badge size (14px, compact padding)
- No longer blocks form width

Synced with dev_odex25_ensan on Wed Nov 12 05:10:51 +03 2025
This commit is contained in:
Mohamed Eltayar 2025-11-12 05:10:51 +03:00
parent 88c5c2bdcd
commit 7f9dd8e140
2 changed files with 6 additions and 17 deletions

View File

@ -207,12 +207,8 @@
var self = this;
var currentData = self.model.localData[self.handle].data;
// CRITICAL: Buttons are editable ONLY if:
// 1. Form is in edit mode (self.mode === 'edit')
// 2. AND state is 'draft'
var isFormEdit = self.mode === 'edit';
var isDraftState = currentData.state === 'draft';
var isEditable = isFormEdit && isDraftState;
var isEditable = isDraftState;
// Remove old event handlers to prevent duplicates
this.$('.record_option').off('click');
@ -243,9 +239,7 @@
}
});
// Disable/Enable buttons based on edit state
if (!isEditable) {
// Disable buttons but KEEP their visual appearance (colors, selection)
this.$('.record_option').css({
'pointer-events': 'none',
'cursor': 'not-allowed'
@ -254,9 +248,8 @@
'pointer-events': 'none',
'cursor': 'not-allowed'
});
return; // Don't attach click handlers
return;
} else {
// Enable buttons in draft state AND edit mode
this.$('.record_option').css({
'pointer-events': 'auto',
'cursor': 'pointer'

View File

@ -84,14 +84,10 @@
<!-- </button>-->
</div>
<!-- Code Badge - Only shown after code is generated -->
<div class="oe_title" attrs="{'invisible': [('code', '=', False)]}">
<h2 style="margin-top: 10px; margin-bottom: 15px;">
<span class="badge badge-primary" style="font-size: 18px; padding: 10px 20px; font-weight: 600; letter-spacing: 1px;">
<i class="fa fa-barcode" style="margin-right: 8px;"/>
<field name="code" nolabel="1" readonly="1"/>
</span>
</h2>
<div style="position: absolute; top: 70px; right: 15px; z-index: 100;" attrs="{'invisible': [('code', '=', False)]}">
<span class="badge badge-info" style="font-size: 14px; padding: 6px 12px;">
<i class="fa fa-barcode"/> <field name="code" nolabel="1" readonly="1"/>
</span>
</div>
<!-- Record Type Selection - Simple & Clean Design -->