fix: module icon + sponsor phone visibility logic

**Changes:**

1. Module Icon Fix
   - Changed 'images' key to 'icon' in __manifest__.py
   - Removed list brackets (icon value is string, not list)
   - Now icon will display correctly in Apps menu
   - Path: static/description/icon5.png

2. Sponsor Phone Field Visibility
   - Added 'invisible' attrs to sponsor_phone field
   - Field now ONLY visible for 'unknown' (فاعل خير) type
   - Hidden for 'registered' and 'new_sponsor' types
   - Reason: sponsor_id Many2one already displays phone number
   - Prevents duplicate phone display in form

**Field Behavior After Fix:**

| Sponsor Type | sponsor_id Field | sponsor_phone Field |
|--------------|------------------|---------------------|
| مشترك بالنظام |  Visible (shows name + phone) |  Hidden |
| مشترك جديد |  Visible (shows name + phone) |  Hidden |
| فاعل خير |  Hidden |  Visible & Editable |

**Technical Details:**

XML attrs for sponsor_phone:
```xml
'invisible': ['|',
    '&', ('record_type','=','donation'), ('sponsor_or_donor_type','!=','unknown'),
    '&', ('record_type','=','sponsorship'), ('sponsor_donor_type','!=','unknown')
],
'readonly': [('state','!=','draft')]
```

Logic:
- Invisible if: (donation AND NOT unknown) OR (sponsorship AND NOT unknown)
- Visible only when: unknown (فاعل خير) type selected
- Editable only in draft state

**User Experience:**
- No more duplicate phone number display
- Cleaner form layout
- Phone field only appears when actually needed (unknown sponsor)
- Module icon now displays correctly

Odoo 14 Compatible. XML validated.
Synced with latest dev_odex25_ensan on Wed Nov 12 03:35:11 +03 2025
This commit is contained in:
Mohamed Eltayar 2025-11-12 03:35:11 +03:00
parent f714b3e5d7
commit 5114d9aa7e
2 changed files with 4 additions and 5 deletions

View File

@ -77,7 +77,7 @@
'reports/transfer_deduction_report.xml',
'reports/transfer_deduction_report_templates.xml',
],
'images': ['static/description/icon5.png'],
'icon': 'static/description/icon5.png',
# 'installable': True,
# 'application': True,
# 'auto_install': False,

View File

@ -192,12 +192,11 @@
<field name="sponsor_phone" string="رقم الجوال" widget="phone"
attrs="{
'readonly': ['|',
('state','!=','draft'),
'|',
'invisible': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','!=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','!=','unknown')
]
],
'readonly': [('state','!=','draft')]
}"
placeholder="05xxxxxxxx"/>