fix: Comprehensive UI fixes - translations, defaults, layout & UX improvements
✅ 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.
This commit is contained in:
parent
d643a35c50
commit
760c0692cf
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,11 +92,11 @@
|
|||
<div class="record_type_options">
|
||||
<div class="record_option donation_option" data-value="donation">
|
||||
<i class="fa fa-heart"></i>
|
||||
<span>Donation</span>
|
||||
<span>تبرع</span>
|
||||
</div>
|
||||
<div class="record_option sponsorship_option" data-value="sponsorship">
|
||||
<i class="fa fa-users"></i>
|
||||
<span>Sponsorship</span>
|
||||
<span>كفالة</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -113,12 +113,12 @@
|
|||
attrs="{'invisible': [('record_type','!=','donation')]}">
|
||||
<div class="mechanism_options">
|
||||
<div class="mechanism_option without_conditions" data-value="without_conditions">
|
||||
<i class="fa fa-gift"></i>
|
||||
<span>Unconditional</span>
|
||||
<i class="fa fa-check-circle"></i>
|
||||
<span>غير مشروط</span>
|
||||
</div>
|
||||
<div class="mechanism_option with_conditions" data-value="with_conditions">
|
||||
<i class="fa fa-list-check"></i>
|
||||
<span>Conditional</span>
|
||||
<i class="fa fa-list-alt"></i>
|
||||
<span>مشروط</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -152,9 +152,9 @@
|
|||
<field name="sponsor_donor_type"
|
||||
attrs="{'invisible': [('record_type','!=','sponsorship')], 'readonly': [('state','!=','draft')]}"/>
|
||||
<button name="create_new_sponsor" type="object"
|
||||
string="إنشاء كافل/متبرع جديد"
|
||||
string="إنشاء مشترك"
|
||||
class="btn-primary oe_highlight"
|
||||
icon="fa-plus-circle"
|
||||
icon="fa-plus"
|
||||
attrs="{
|
||||
'invisible': [
|
||||
'|','|',('sponsor_id','!=',False),
|
||||
|
|
@ -176,9 +176,13 @@
|
|||
attrs="{'invisible': [('sponsor_id','=',False), ('sponsor_or_donor_type','!=','registered')]}"
|
||||
force_save="1" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
|
||||
<field name="sponsor_phone" widget="phone"
|
||||
<field name="sponsor_phone" string="رقم الجوال" widget="phone"
|
||||
attrs="{'invisible': [('sponsor_or_donor_type','=', False)], 'readonly': [('sponsor_or_donor_type', '!=', 'unknown')]}"
|
||||
placeholder="05xxxxxxxx" help="Saudi mobile number format"/>
|
||||
|
||||
<field name="preferred_communication"
|
||||
attrs="{'invisible': ['|', ('sponsor_or_donor_type','!=','new_sponsor'), ('record_type','!=','donation')], 'required': [('sponsor_or_donor_type','=','new_sponsor')]}"
|
||||
force_save="1" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
</group>
|
||||
|
||||
<group name="group_right" string="Basic Information">
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@
|
|||
|
||||
<group attrs="{'invisible': [('company_type', '!=', 'person')]}">
|
||||
<div class="o_row">
|
||||
<field placeholder="Title" name="title" class="oe_inline" nolabel="1"
|
||||
<field placeholder="اللقب" name="title" class="oe_inline" nolabel="1" style="width: 20%;"
|
||||
domain="[('position', 'in', ['prefix','both'])]"
|
||||
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
|
||||
<field placeholder="Name" name="first_name" class="oe_inline" nolabel="1"/>
|
||||
<field placeholder="Suffix Title" name="suffix_title_id" class="oe_inline" nolabel="1"
|
||||
<field placeholder="الاسم" name="first_name" class="oe_inline" nolabel="1" style="width: 60%;"/>
|
||||
<field placeholder="العبارة الختامية" name="suffix_title_id" class="oe_inline" nolabel="1" style="width: 20%;"
|
||||
domain="[('position', 'in', ['suffix','both'])]"
|
||||
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
|
||||
</div>
|
||||
|
|
@ -93,8 +93,8 @@
|
|||
|
||||
<group name="group_top">
|
||||
<group name="group_left">
|
||||
<field name="mobile" attrs="{'required': [('parent_id', '=', False)]}"/>
|
||||
<field name="id_number" attrs="{'invisible': [('company_type', '!=', 'person')]}"/>
|
||||
<field name="mobile" string="رقم الجوال" widget="phone" placeholder="05xxxxxxxx" attrs="{'required': [('parent_id', '=', False)]}"/>
|
||||
<field name="preferred_communication" string="طريقة التواصل المفضلة" required="1"/>
|
||||
<field name="gender" attrs="{'required': [('company_type', '=', 'person')],'invisible': [('company_type', '!=', 'person')]}"/>
|
||||
<field name="street" attrs="{'invisible': [('company_type', '=', 'person')]}"/>
|
||||
<field name="zip" attrs="{'invisible': [('company_type', '=', 'person')]}"/>
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
<field name="city_id"/>
|
||||
<field name="branch_custom_id"/>
|
||||
<field name="district_id" invisible="1"/>
|
||||
<field name="preferred_communication" required="1"/>
|
||||
<field name="id_number" attrs="{'invisible': [('company_type', '!=', 'person')]}"/>
|
||||
<!-- <field name="journal_id"/> -->
|
||||
<!-- <label for="account_number" string="Bank Account"/>
|
||||
<div class="o_address_format">
|
||||
|
|
|
|||
Loading…
Reference in New Issue