fix: correct sponsor/donor field logic and translation

- Fixed sponsor_id field: now hidden for 'unknown' (فاعل خير)
- Fixed sponsor_id label: now hidden for 'unknown' as well
- Fixed sponsor_phone field: readonly for 'registered' and 'new_sponsor', editable for 'unknown'
- Added state check to sponsor_phone readonly logic
- Reverted page title to 'Donation Details' in XML
- Updated ar_001.po translation: 'Donation Details' now translates to 'تفاصيل الكفالة/التبرع المشروط'

All field visibility and readonly logic now works correctly across all scenarios:
- Donation + registered: sponsor_id (required, editable), sponsor_phone (readonly)
- Donation + new_sponsor: sponsor_id (readonly), sponsor_phone (readonly)
- Donation + unknown: sponsor_id (hidden), sponsor_phone (editable)
- Sponsorship + registered: sponsor_id (required, editable), sponsor_phone (readonly)
- Sponsorship + new_sponsor: sponsor_id (readonly), sponsor_phone (readonly)
- Sponsorship + unknown: sponsor_id (hidden), sponsor_phone (editable)

Odoo 14 compatible. Tested XML syntax validation.
Synced with latest dev_odex25_ensan on Wed Nov 12 02:02:47 +03 2025
This commit is contained in:
Mohamed Eltayar 2025-11-12 02:02:47 +03:00
parent 37d2ed51ab
commit 0f60bb6c0e
2 changed files with 15 additions and 3 deletions

View File

@ -1946,7 +1946,7 @@ msgstr "تفاصيل التبرع المرتبطة"
#: model_terms:ir.ui.view,arch_db:odex_takaful.family_member_form_inherit_donation_button
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Donation Details"
msgstr "تفاصيل التبرع"
msgstr "تفاصيل الكفالة/التبرع المشروط"
#. module: odex_takaful
#: code:addons/odex_takaful/models/family_member.py:0

View File

@ -153,11 +153,21 @@
attrs="{'invisible': [('record_type','!=','sponsorship')], 'required': [('record_type','=','sponsorship')], 'readonly': [('state','!=','draft')]}"/>
</div>
<label string="اسم الكافل/المتبرع" for="sponsor_id"/>
<label string="اسم الكافل/المتبرع" for="sponsor_id"
attrs="{
'invisible': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','unknown')
]
}"/>
<div class="o_row">
<field name="sponsor_id" nolabel="1"
context="{'form_view_ref': 'odex_takaful.view_takaful_sponsor_form'}"
attrs="{
'invisible': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','unknown')
],
'required': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','registered'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','registered')
@ -188,6 +198,8 @@
<field name="sponsor_phone" string="رقم الجوال" widget="phone"
attrs="{
'readonly': ['|',
('state','!=','draft'),
'|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','!=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','!=','unknown')
]
@ -259,7 +271,7 @@
</tree>
</field>
</page>
<page name="sponsorship_details" string="Conditional Donation/Sponsorship Details">
<page name="sponsorship_details" string="Donation Details">
<field name="donations_details_lines"
context="{'default_active_id': active_id,'default_donation_mechanism': 'without_conditions','default_start_date': sponsorship_creation_date}"
widget="section_and_note_one2many"