[FIX] odex_takaful

This commit is contained in:
Samir Ladoui 2026-01-15 14:54:16 +01:00
parent 1a4102a30c
commit 0094aeb7db
2 changed files with 155 additions and 152 deletions

View File

@ -5,99 +5,98 @@
<!-- Standard report container to provide <main> for PDF engine --> <!-- Standard report container to provide <main> for PDF engine -->
<t t-call="web.html_container"> <t t-call="web.html_container">
<!-- Get all extension history records for the same invoice --> <!-- Get all extension history records for the same invoice -->
<t t-set="invoice_id" t-value="docs[0].invoice_id if docs else False"/> <t t-foreach="docs" t-as="o">
<t t-set="all_extensions" t-value="docs.env['donation.extension.history'].search([('invoice_id', '=', invoice_id.id)]) if invoice_id else docs"/> <t t-set="invoice_id" t-value="o.invoice_id"/>
<t t-set="sponsorship" t-value="all_extensions[0].sponsorship_id if all_extensions else False"/> <t t-set="sponsorship" t-value="o.donation_detail_id.sponsorship_mechanism_id"/>
<t t-if="sponsorship"> <t t-if="sponsorship">
<!-- Reuse sale order header layout --> <!-- Reuse sale order header layout -->
<t t-call="sale_order_report.sale_order_report_header"> <t t-call="sale_order_report.sale_order_report_header">
<div class="page font-noto" style="position: relative; min-height: 800px; overflow: visible;" dir="rtl"> <div class="page font-noto" style="position: relative; min-height: 800px; overflow: visible;" dir="rtl">
<div style="position: relative; z-index: 1;"> <div style="position: relative; z-index: 1;">
<div class="oe_structure"/> <div class="oe_structure"/>
<!-- Greeting / intro --> <!-- Greeting / intro -->
<div style="text-align: right; margin-bottom: 20px; padding-top: 250px;"> <div style="text-align: right; margin-bottom: 20px; padding-top: 250px;">
<div style="font-size: 1.5rem; color: #6B6B6A; font-weight: bold;"> <div style="font-size: 1.5rem; color: #6B6B6A; font-weight: bold;">
مرحباً مرحباً
<span style="color: #387F75;" t-esc="sponsorship.sponsor_name or sponsorship.sponsor_id.name"/> <span style="color: #387F75;" t-esc="sponsorship.sponsor_name or sponsorship.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.3rem; color: #6B6B6A;">
ونتشرف دائما باستقبال عطائك المستمر لدعم أبنائكم الأيتام.
</div>
</div> </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.3rem; color: #6B6B6A;">
ونتشرف دائما باستقبال عطائك المستمر لدعم أبنائكم الأيتام.
</div>
</div>
<!-- Extension info --> <!-- Extension info -->
<div style="text-align: right; margin-bottom: 20px;"> <div style="text-align: right; margin-bottom: 20px;">
<div style="font-size: 1.3rem; color: #8F9090;"> <div style="font-size: 1.3rem; color: #8F9090;">
<span style="font-weight: bold;">رقم الكفالة: </span> <span style="font-weight: bold;">رقم الكفالة: </span>
<t t-esc="sponsorship.code"/> <t t-esc="sponsorship.code"/>
</div>
<div style="font-size: 1.4rem; color: #8F9090;">
<span style="font-weight: bold;">تاريخ التجديد: </span>
<bdi style="display: inline; direction: rtl; unicode-bidi: embed; white-space: nowrap;">
<span t-field="o.extension_date"
t-options='{"format": "dd MMMM yyyy - HH:mm"}'/>
</bdi>
</div>
</div> </div>
<div style="font-size: 1.4rem; color: #8F9090;">
<span style="font-weight: bold;">تاريخ التجديد: </span>
<bdi style="display: inline; direction: rtl; unicode-bidi: embed; white-space: nowrap;">
<span t-field="all_extensions[0].extension_date"
t-options='{"format": "dd MMMM yyyy - HH:mm"}'/>
</bdi>
</div>
</div>
<!-- Extension Lines table --> <!-- Extension Lines table -->
<table class="table table-bordered" style="text-align: right;"> <table class="table table-bordered" style="text-align: right;">
<thead> <thead>
<tr style="background-color: #f8f9fa;"> <tr style="background-color: #f8f9fa;">
<th style="text-align: right; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: right; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
نوع التبرع نوع التبرع
</th> </th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
التفاصيل التفاصيل
</th> </th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
الفترة الجديدة الفترة الجديدة
</th> </th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ المبلغ
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<t t-foreach="all_extensions" t-as="ext">
<tr> <tr>
<!-- نوع التبرع --> <!-- نوع التبرع -->
<td style="text-align: right; padding: 8px; font-size: 1.3rem; color: #387F75;"> <td style="text-align: right; padding: 8px; font-size: 1.3rem; color: #387F75;">
<span t-esc="ext.product_template_id.with_context(lang='ar_001').name or ext.product_template_id.name"/> <span t-esc="o.product_template_id.with_context(lang='ar_001').name or o.product_template_id.name"/>
</td> </td>
<!-- التفاصيل --> <!-- التفاصيل -->
<td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;"> <td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<t t-if="ext.donation_detail_id.benefit_id"> <t t-if="o.donation_detail_id.benefit_id">
<span t-esc="(ext.donation_detail_id.benefit_id.name or '').split()[0]"/> - <span t-esc="ext.donation_detail_id.benefit_family_code or '-'"/> <span t-esc="(o.donation_detail_id.benefit_id.name or '').split()[0]"/> - <span t-esc="o.donation_detail_id.benefit_family_code or '-'"/>
</t> </t>
<t t-else=""> <t t-else="">
<span t-esc="ext.donation_detail_id.family_id.code or '-'"/> <span t-esc="o.donation_detail_id.family_id.code or '-'"/>
</t> </t>
<br/> <br/>
<small style="color: #8F9090;">شهور التمديد: <span t-esc="ext.extension_months"/></small> <small style="color: #8F9090;">شهور التمديد: <span t-esc="o.extension_months"/></small>
</td> </td>
<!-- الفترة الجديدة --> <!-- الفترة الجديدة -->
<td style="text-align: center; padding: 8px; font-size: 1.2rem; color: #387F75;"> <td style="text-align: center; padding: 8px; font-size: 1.2rem; color: #387F75;">
من: <span t-field="ext.old_end_date" t-options='{"format": "dd/MM/yyyy"}'/> من: <span t-field="o.old_end_date" t-options='{"format": "dd/MM/yyyy"}'/>
<br/> <br/>
إلى <span t-field="ext.new_end_date" t-options='{"format": "dd/MM/yyyy"}'/> إلى <span t-field="o.new_end_date" t-options='{"format": "dd/MM/yyyy"}'/>
</td> </td>
<!-- المبلغ --> <!-- المبلغ -->
<td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;"> <td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<t t-set="amt" t-value="ext.extension_amount"/> <t t-set="amt" t-value="o.extension_amount"/>
<t t-if="amt == int(amt)"> <t t-if="amt == int(amt)">
<span t-esc="'{:,.0f}'.format(amt)"/> <small>ر.س</small> <span t-esc="'{:,.0f}'.format(amt)"/> <small>ر.س</small>
</t> </t>
@ -106,100 +105,100 @@
</t> </t>
</td> </td>
</tr> </tr>
</t>
<!-- Summary Row: المجموع --> <!-- Summary Row: المجموع -->
<tr style="background-color: #f8f9fa;"> <tr style="background-color: #f8f9fa;">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;"> <td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<strong>المجموع:</strong> <strong>المجموع:</strong>
</td> </td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;"> <td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong> <strong>-</strong>
</td> </td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;"> <td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong> <strong>-</strong>
</td> </td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;"> <td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong> <strong>
<t t-set="total_amt" t-value="sum(ext.extension_amount for ext in all_extensions)"/> <t t-set="total_amt" t-value="o.extension_amount"/>
<t t-if="total_amt == int(total_amt)"> <t t-if="total_amt == int(total_amt)">
<span t-esc="'{:,.0f}'.format(total_amt)"/> <small>ر.س</small> <span t-esc="'{:,.0f}'.format(total_amt)"/> <small>ر.س</small>
</t> </t>
<t t-else=""> <t t-else="">
<span t-esc="'{:,.2f}'.format(total_amt)"/> <small>ر.س</small> <span t-esc="'{:,.2f}'.format(total_amt)"/> <small>ر.س</small>
</t> </t>
</strong> </strong>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!-- Payments table: وسيلة الدفع والمبلغ --> <!-- Payments table: وسيلة الدفع والمبلغ -->
<table class="table table-bordered" style="text-align: right; margin-top: 12px;"> <table class="table table-bordered" style="text-align: right; margin-top: 12px;">
<thead> <thead>
<tr style="background-color: #f8f9fa;"> <tr style="background-color: #f8f9fa;">
<th style="text-align: right; width: 75%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: right; width: 75%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
وسيلة الدفع وسيلة الدفع
</th> </th>
<th style="text-align: center; width: 25%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;"> <th style="text-align: center; width: 25%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ المبلغ
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<t t-if="sponsorship and sponsorship.payment_ids"> <t t-if="sponsorship and sponsorship.payment_ids">
<t t-foreach="sponsorship.payment_ids.filtered(lambda p: invoice_id.id in p.reconciled_invoice_ids.ids)" t-as="pay"> <t t-foreach="sponsorship.payment_ids.filtered(lambda p: invoice_id.id in p.reconciled_invoice_ids.ids)" t-as="pay">
<tr> <tr>
<td style="text-align: right; padding: 8px; font-size: 1.3rem; color: #387F75;"> <td style="text-align: right; padding: 8px; font-size: 1.3rem; color: #387F75;">
<span t-esc="pay.with_context(lang='ar_001').payment_method_line_id.name or pay.with_context(lang='ar_001').payment_method_id.name"/> <span t-esc="pay.with_context(lang='ar_001').payment_method_line_id.name or pay.with_context(lang='ar_001').payment_method_id.name"/>
</td> </td>
<td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;"> <td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<t t-set="pay_amt" t-value="0"/> <t t-set="pay_amt" t-value="0"/>
<t t-foreach="invoice_id.line_ids.filtered(lambda l: l.account_id.internal_type in ('receivable', 'payable'))" t-as="inv_line"> <t t-foreach="invoice_id.line_ids.filtered(lambda l: l.account_id.internal_type in ('receivable', 'payable'))" t-as="inv_line">
<t t-foreach="inv_line.matched_debit_ids + inv_line.matched_credit_ids" t-as="partial"> <t t-foreach="inv_line.matched_debit_ids + inv_line.matched_credit_ids" t-as="partial">
<t t-if="partial.credit_move_id.payment_id == pay or partial.debit_move_id.payment_id == pay"> <t t-if="partial.credit_move_id.payment_id == pay or partial.debit_move_id.payment_id == pay">
<t t-set="pay_amt" t-value="pay_amt + partial.amount"/> <t t-set="pay_amt" t-value="pay_amt + partial.amount"/>
</t>
</t> </t>
</t> </t>
<t t-if="pay_amt == int(pay_amt)">
<span t-esc="'{:,.0f}'.format(pay_amt)"/> <small>ر.س</small>
</t>
<t t-else="">
<span t-esc="'{:,.2f}'.format(pay_amt)"/> <small>ر.س</small>
</t>
</td>
</tr>
</t> </t>
<tr style="background-color: #f8f9fa;">
<t t-if="pay_amt == int(pay_amt)"> <td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<span t-esc="'{:,.0f}'.format(pay_amt)"/> <small>ر.س</small> <strong>
</t> <span style="margin-left: 10px;">الإجمالي:</span>
<t t-else=""> </strong>
<span t-esc="'{:,.2f}'.format(pay_amt)"/> <small>ر.س</small> </td>
</t> <td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<t t-set="final_amt" t-value="o.extension_amount"/>
<t t-if="final_amt == int(final_amt)">
<span t-esc="'{:,.0f}'.format(final_amt)"/> <small>ر.س</small>
</t>
<t t-else="">
<span t-esc="'{:,.2f}'.format(final_amt)"/> <small>ر.س</small>
</t>
</td> </td>
</tr> </tr>
</t> </t>
<tr style="background-color: #f8f9fa;"> <t t-else="">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;"> <tr>
<strong> <td colspan="2" style="text-align: center; padding: 8px; font-size: 1.3rem; color: #6B6B6A;">
<span style="margin-left: 10px;">الإجمالي:</span> <span>لا توجد دفعات</span>
</strong> </td>
</td> </tr>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;"> </t>
<t t-set="final_amt" t-value="sum(ext.extension_amount for ext in all_extensions)"/> </tbody>
<t t-if="final_amt == int(final_amt)"> </table>
<span t-esc="'{:,.0f}'.format(final_amt)"/> <small>ر.س</small> </div>
</t>
<t t-else="">
<span t-esc="'{:,.2f}'.format(final_amt)"/> <small>ر.س</small>
</t>
</td>
</tr>
</t>
<t t-else="">
<tr>
<td colspan="2" style="text-align: center; padding: 8px; font-size: 1.3rem; color: #6B6B6A;">
<span>لا توجد دفعات</span>
</td>
</tr>
</t>
</tbody>
</table>
</div> </div>
</div> </t>
</t> </t>
</t> </t>
</t> </t>

View File

@ -158,7 +158,11 @@
<field name="name">Branch Manager: All Branch Donation Lines</field> <field name="name">Branch Manager: All Branch Donation Lines</field>
<field name="model_id" ref="model_donations_details_lines"/> <field name="model_id" ref="model_donations_details_lines"/>
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/> <field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]</field> <field name="domain_force">[
'|',
('sponsorship_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id),
('sponsorship_mechanism_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)
]</field>
</record> </record>
<record id="sponsor_department_rule" model="ir.rule"> <record id="sponsor_department_rule" model="ir.rule">