Merge pull request #6211 from expsa/samir_aladawi_fix_rule_donations_details_lines

[FIX] odex_takaful
This commit is contained in:
SamirLADOUI-sa 2026-01-15 14:56:26 +01:00 committed by GitHub
commit e08658215e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 155 additions and 152 deletions

View File

@ -5,9 +5,9 @@
<!-- Standard report container to provide <main> for PDF engine -->
<t t-call="web.html_container">
<!-- 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-set="all_extensions" t-value="docs.env['donation.extension.history'].search([('invoice_id', '=', invoice_id.id)]) if invoice_id else docs"/>
<t t-set="sponsorship" t-value="all_extensions[0].sponsorship_id if all_extensions else False"/>
<t t-foreach="docs" t-as="o">
<t t-set="invoice_id" t-value="o.invoice_id"/>
<t t-set="sponsorship" t-value="o.donation_detail_id.sponsorship_mechanism_id"/>
<t t-if="sponsorship">
<!-- Reuse sale order header layout -->
@ -44,7 +44,7 @@
<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"
<span t-field="o.extension_date"
t-options='{"format": "dd MMMM yyyy - HH:mm"}'/>
</bdi>
</div>
@ -69,35 +69,34 @@
</tr>
</thead>
<tbody>
<t t-foreach="all_extensions" t-as="ext">
<tr>
<!-- نوع التبرع -->
<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 style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<t t-if="ext.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 '-'"/>
<t t-if="o.donation_detail_id.benefit_id">
<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-else="">
<span t-esc="ext.donation_detail_id.family_id.code or '-'"/>
<span t-esc="o.donation_detail_id.family_id.code or '-'"/>
</t>
<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 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/>
إلى <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 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)">
<span t-esc="'{:,.0f}'.format(amt)"/> <small>ر.س</small>
</t>
@ -106,7 +105,6 @@
</t>
</td>
</tr>
</t>
<!-- Summary Row: المجموع -->
<tr style="background-color: #f8f9fa;">
@ -121,7 +119,7 @@
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<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)">
<span t-esc="'{:,.0f}'.format(total_amt)"/> <small>ر.س</small>
</t>
@ -179,7 +177,7 @@
</strong>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<t t-set="final_amt" t-value="sum(ext.extension_amount for ext in all_extensions)"/>
<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>
@ -203,5 +201,6 @@
</t>
</t>
</t>
</t>
</template>
</odoo>

View File

@ -158,7 +158,11 @@
<field name="name">Branch Manager: All Branch Donation Lines</field>
<field name="model_id" ref="model_donations_details_lines"/>
<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 id="sponsor_department_rule" model="ir.rule">