From 760c0692cf13df03212101bb18c81fd9816ac953 Mon Sep 17 00:00:00 2001 From: Mohamed Eltayar Date: Wed, 12 Nov 2025 00:02:40 +0300 Subject: [PATCH] fix: Comprehensive UI fixes - translations, defaults, layout & UX improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Fixed default values: - Set sponsor_or_donor_type default to 'registered' (مشترك بالنظام) - Added default selection for donation_mechanism (غير مشروط) ✅ Fixed translations issue: - Replaced English text with Arabic directly in XML spans - Changed 'Donation' → 'تبرع', 'Sponsorship' → 'كفالة' - Changed 'Unconditional' → 'غير مشروط', 'Conditional' → 'مشروط' - Fixed phone field translation to 'رقم الجوال' ✅ Enhanced button & layout: - Changed button text to 'إنشاء مشترك' with fa-plus icon - Added preferred_communication field for new_sponsor type - Fixed top spacing by reducing h1 margins ✅ Improved button consistency: - Unified mechanism buttons width (120px) and centered alignment - Added consistent icons: fa-check-circle & fa-list-alt - Fixed icon sizing and alignment (20px width, centered) ✅ Enhanced sponsor form (partner.sponsor.form): - Improved name fields layout: Title(20%) + Name(60%) + Suffix(20%) - Reordered fields: mobile → preferred_communication → other fields - Moved id_number to group_right, preferred_communication to group_left - Added Arabic placeholders and proper field labels ✅ JavaScript improvements: - Added default selection for donation_mechanism when empty - Fixed visual selection persistence and field interaction All changes are fully compatible with Odoo 14 standards and tested. --- .../models/takaful_sponorship_model.py | 2 +- odex25_ensan/odex_takaful/views/assets.xml | 18 ++++++++++++++- .../views/takaful_sponorship_view.xml | 22 +++++++++++-------- .../views/takaful_sponsor_view.xml | 12 +++++----- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py index b488685b4..713f5a920 100644 --- a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py +++ b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py @@ -67,7 +67,7 @@ class TakafulSponsorship(models.Model): branch_custom_id = fields.Many2one('branch.settings', string="Branch", default=lambda self: self._default_branch_custom_id(), required=True, tracking=True) sponsorship_creation_date = fields.Datetime(string="Sponsorship Creation Date", default=fields.Datetime.now, required=True, copy=False) sponsor_note = fields.Text(string='Sponsor Note') - sponsor_or_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor'), ('unknown', 'Unknown')], required=True) + sponsor_or_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor'), ('unknown', 'Unknown')], required=True, default='registered') # ('not_registered', 'Not Registered'), sponsor_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor')]) sponsor_name = fields.Char(string="Sponsor Name") diff --git a/odex25_ensan/odex_takaful/views/assets.xml b/odex25_ensan/odex_takaful/views/assets.xml index 132372962..26afaa7ae 100644 --- a/odex25_ensan/odex_takaful/views/assets.xml +++ b/odex25_ensan/odex_takaful/views/assets.xml @@ -29,6 +29,12 @@ direction: ltr; } + /* Fix top spacing caused by h1 */ + h1 { + margin-bottom: 5px !important; + margin-top: 5px !important; + } + /* Record Type Simple & Clean Design */ .o_record_type_simple { background: #f8f9fa; @@ -111,7 +117,14 @@ display: flex; align-items: center; gap: 8px; - min-width: 100px; + min-width: 120px; + justify-content: center; + } + + .mechanism_option i { + width: 20px; + text-align: center; + font-size: 16px; } .mechanism_option:hover { @@ -210,6 +223,9 @@ var currentMechanism = self.model.localData[self.handle].data.donation_mechanism; if (currentMechanism) { self.$('.mechanism_option[data-value="' + currentMechanism + '"]').addClass('selected'); + } else { + // Default to without_conditions (غير مشروط) as requested + self.$('.mechanism_option[data-value="without_conditions"]').addClass('selected'); } }, 100); } diff --git a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml index 06a4e01dc..6177cf884 100644 --- a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml +++ b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml @@ -92,11 +92,11 @@
- Donation + تبرع
- Sponsorship + كفالة
@@ -113,12 +113,12 @@ attrs="{'invisible': [('record_type','!=','donation')]}">
- - Unconditional + + غير مشروط
- - Conditional + + مشروط
@@ -152,9 +152,9 @@