Merge branch 'dev_odex25_takaful' of https://github.com/expsa/odex25-standard-modules into fix_bugs

This commit is contained in:
Nossibaelhadi 2026-01-08 14:49:28 +03:00
commit 3070db1d22
7 changed files with 61 additions and 30 deletions

View File

@ -78,6 +78,9 @@ class DonationsDetailsLines(models.Model):
sponsor_id = fields.Many2one('res.partner', compute='_compute_sponsor_id', store=True, readonly=True)
sponsor_phone = fields.Char(related='sponsor_id.mobile')
branch_custom_id = fields.Many2one('branch.settings', compute='_compute_branch_custom_id')
# Stored helper field used solely for grouping in the UI.
branch_group_id = fields.Many2one(
'branch.settings', compute='_compute_branch_group_id', store=True, index=True, search='_search_branch_group_id')
record_type = fields.Selection([('sponsorship', 'Sponsorship'),('donation', 'Donation')], compute='_compute_record_type', store=True, readonly=True)
state = fields.Selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('waiting', 'Waiting'), ('active', 'Active'),('closed', 'Closed'),('extended', 'Extended'),('replace', 'To Replace'), ('paid', 'Paid'),('cancel', 'Canceled')], string='State', default='draft')
sponsorship_scheduling_line_ids = fields.One2many('sponsorship.scheduling.line', 'donation_detail_linked_id')
@ -295,6 +298,15 @@ class DonationsDetailsLines(models.Model):
for rec in self:
rec.branch_custom_id = rec.sponsorship_id.branch_custom_id or rec.sponsorship_mechanism_id.branch_custom_id
@api.depends('sponsorship_id.branch_custom_id', 'sponsorship_mechanism_id.branch_custom_id')
def _compute_branch_group_id(self):
for rec in self:
rec.branch_group_id = rec.sponsorship_id.branch_custom_id or rec.sponsorship_mechanism_id.branch_custom_id
@api.model
def _search_branch_group_id(self, operator, value):
return ['|', ('sponsorship_id.branch_custom_id', operator, value), ('sponsorship_mechanism_id.branch_custom_id', operator, value)]
@api.depends('direct_debit', 'end_date')
def _compute_show_extend_button(self):
today = fields.Date.today()

View File

@ -7,8 +7,7 @@
<t t-foreach="docs" t-as="doc">
<!-- Reuse sale order header layout -->
<t t-call="sale_order_report.sale_order_report_header">
<div class="page" style="position: relative; min-height: 800px; overflow: visible;">
<div class="page font-noto" style="position: relative; min-height: 800px; overflow: visible;" dir="rtl">
<!-- Watermark for canceled sponsorships -->
<t t-if="doc.state == 'canceled'">
<div style="position: absolute;
@ -41,13 +40,17 @@
<div class="oe_structure"/>
<!-- Greeting / intro -->
<div style="text-align: right; margin-bottom: 20px; padding-top: 300px;">
<div style="text-align: right; margin-bottom: 20px; padding-top: 250px;">
<div style="font-size: 1.5rem; color: #6B6B6A; font-weight: bold;">
مرحباً
<span style="color: #387F75;" t-esc="doc.sponsor_id.name or 'فاعل خير'"/>
<span style="color: #387F75;" t-esc="doc.sponsor_name or doc.sponsor_id.name if doc.sponsor_or_donor_type == 'unknown' else doc.sponsor_id.name"/>
</div>
<div style="font-size: 1.5rem; margin-top: 10px; color: #6B6B6A;">
بكل امتنان نشكر لك تبرعك الكريم، ونسأل الله أن يجعلك ممن يرافقون النبي ﷺ في الجنة.
بكل امتنان نشكر لك تبرعك الكريم، ونسأل الله أن يجعلك ممن يرافقون النبي <span style="white-space: nowrap;">
<img src="/odex_takaful/static/src/img/U+FDFA.svg"
style="height: 1.5em; vertical-align: middle; margin-bottom: 2px;"
alt="ﷺ"/>
</span><br/> في الجنة.
</div>
<div style="font-size: 1.5rem; color: #6B6B6A;">
ونتشرف دائما باستقبال عطائك المستمر لدعم أبنائكم الأيتام.
@ -56,17 +59,22 @@
<!-- Sponsorship info -->
<div style="text-align: right; margin-bottom: 20px;">
<span style="font-size: 1.5rem; color: #8F9090;">
[رقم الكفالة:
<t t-set="variable" t-value="value"/>
<div style="font-size: 1.5rem; color: #8F9090;">
<t t-if="doc.record_type == 'sponsorship'">
<span style="font-weight: bold;">رقم الكفالة: </span>
</t>
<t t-else="">
<span style="font-weight: bold;">رقم السند: </span>
</t>
<t t-esc="doc.code"/>
]
</span>
<span style="font-size: 1.5rem; color: #8F9090;">
(
<t t-esc="doc.sponsorship_creation_date"
t-options='{"widget": "date", "format": "dd MMMM yyyy"}'/>
)
</span>
</div>
<div style="font-size: 1.5rem; color: #8F9090;">
<span style="font-weight: bold;">التاريخ: </span>
<span t-field="doc.sponsorship_creation_date"
t-options='{"format": "dd MMMM yyyy HH:mm"}'
dir="ltr"/>
</div>
</div>
<!-- Lines table -->
@ -90,7 +98,7 @@
<t t-if="not line.display_type">
<tr>
<td style="text-align: right; padding: 8px; font-size: 1.5rem; color: #387F75; font-weight: bold;">
<span t-esc="line.product_template_id.name"/>
<span t-esc="line.with_context(lang='ar').product_template_id.name"/>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.5rem; color: #387F75; font-weight: bold;">
<span t-esc="line.donation_qty"

View File

@ -140,12 +140,11 @@
<field name="name">Kufula User</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<odoo>
<record id="group_print_receipt" model="res.groups">
<field name="name">Sponsorship Receipt</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
</odoo>
<record id="donation_officer_group" model="res.groups">
<field name="name">Donations Officer</field>
@ -251,11 +250,12 @@
</record>
<!-- Groups for Department-based Access Control -->
<record id="group_beneficiary_department_access" model="res.groups">
<!-- <record id="group_beneficiary_department_access" model="res.groups">
<field name="name">Beneficiary - Department Access</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
<field name="comment">Limits beneficiary records to user's department</field>
</record>
</record> -->
<record id="group_sponsor_department_access" model="res.groups">
<field name="name">Sponsor - Department Access</field>
@ -263,12 +263,11 @@
<field name="comment">Limits sponsor records to user's department</field>
</record>
<!-- Record Rules for Department-based Access Control -->
<record id="grant_benefit_department_rule" model="ir.rule">
<!-- <record id="grant_benefit_department_rule" model="ir.rule">
<field name="name">Grant Benefit - Department Based Access</field>
<field name="model_id" ref="odex_benefit.model_grant_benefit"/>
<field name="groups" eval="[(4, ref('group_beneficiary_department_access'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]
</field>
<field name="domain_force">[('branch_custom_id.branch', '=', user.employee_id.department_id.id)]</field>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
@ -279,12 +278,12 @@
<field name="name">Family Member - Department Based Access</field>
<field name="model_id" ref="odex_benefit.model_family_member"/>
<field name="groups" eval="[(4, ref('group_beneficiary_department_access'))]"/>
<field name="domain_force">[('benefit_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]</field>
<field name="domain_force">[('benefit_id.branch_custom_id.branch', '=', user.employee_id.department_id.id)]</field>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
</record> -->
<record id="sponsor_department_rule" model="ir.rule">
<field name="name">Sponsor - Department Based Access</field>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -0,0 +1,3 @@
.font-noto {
font-family: 'Odoo Unicode Support Noto' !important;
}

View File

@ -1,6 +1,12 @@
<?xml version="1.0"?>
<odoo>
<template id="report_assets_common" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/scss" href="/odex_takaful/static/src/scss/receipt_document.scss"/>
</xpath>
</template>
<template id="assets_backend" name="product_catalogue_assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/scss" href="/odex_takaful/static/src/scss/donation_item_views.scss"/>
@ -14,6 +20,7 @@
</xpath>
</template>
<!-- تحسينات بسيطة للتكافل -->
<template id="takaful_simple_enhancements" inherit_id="web.assets_backend">
<xpath expr="." position="inside">

View File

@ -11,6 +11,7 @@
<field name="benefit_id"/>
<field name="product_template_id"/>
<field name="branch_custom_id"/>
<field name="branch_group_id"/>
<field name="family_id"/>
<field name="education_level"/>
<separator/>
@ -50,7 +51,7 @@
<filter string="Sponsorship Duration" name="group_duration" context="{'group_by': 'sponsorship_duration'}"/>
<filter string="Donation Mechanism" name="group_mechanism" context="{'group_by': 'donation_mechanism'}"/>
<filter string="Sponsor" name="group_sponsor" context="{'group_by': 'sponsor_id'}"/>
<filter string="Branch" name="group_branch" context="{'group_by': 'branch_custom_id'}"/>
<filter string="Branch" name="group_branch" context="{'group_by': 'branch_group_id'}"/>
<filter string="Product" name="group_product" context="{'group_by': 'product_template_id'}"/>
<filter string="Creation Date" name="group_creation_date" context="{'group_by': 'create_date'}"/>
</group>