[UPD] odex_takaful: orphan report
This commit is contained in:
parent
6b31562d18
commit
b75fd11de6
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
'data/sequence_data.xml',
|
||||
'data/scheduled_actions.xml',
|
||||
'data/ir_actions_server_data.xml',
|
||||
'views/reports_paperformats.xml',
|
||||
'views/reports_templates.xml',
|
||||
'views/reports_actions.xml',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="server_action_print_and_send_orphan_reports" model="ir.actions.server">
|
||||
<field name="name">Print/Send Orphan Report</field>
|
||||
<field name="model_id" ref="odex_benefit.model_family_member"/>
|
||||
<field name="binding_model_id" ref="odex_benefit.model_family_member"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = records.server_action_print_and_send_orphan_reports()</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="server_action_print_and_send_orphan_mother_reports" model="ir.actions.server">
|
||||
<field name="name">Print/Send Orphan Mother Report</field>
|
||||
<field name="model_id" ref="odex_benefit.model_family_member"/>
|
||||
<field name="binding_model_id" ref="odex_benefit.model_family_member"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = records.server_action_print_and_send_orphan_mother_reports()</field>
|
||||
</record> -->
|
||||
|
||||
</odoo>
|
||||
|
|
@ -59,6 +59,9 @@ class FamilyMember(models.Model):
|
|||
allowed_sponsorship = fields.Boolean(related='benefit_id.benefit_category_id.allowed_sponsorship')
|
||||
|
||||
|
||||
def server_action_print_and_send_orphan_reports(self):
|
||||
return self.env.ref('odex_takaful.action_report_orphan').report_action(self)
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
show_age = self.env.context.get('show_age_in_kafalat')
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@
|
|||
<template id="report_orphan_document">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<div class="page">
|
||||
<!-- Get donation line from donations_details_lines_mechanism_ids relationship -->
|
||||
<t t-set="donation_line" t-value="doc.donations_details_lines_mechanism_ids[0] if doc.donations_details_lines_mechanism_ids else False"/>
|
||||
<!-- <t t-set="donation_line" t-value="doc.donations_details_lines_mechanism_ids[0] if doc.donations_details_lines_mechanism_ids else False"/>
|
||||
<t t-set="benefit_member" t-value="donation_line.benefit_id if donation_line and donation_line.benefit_id else False"/>
|
||||
<t t-set="family" t-value="benefit_member.benefit_id if benefit_member and benefit_member.benefit_id else False"/>
|
||||
<t t-set="family" t-value="benefit_member.benefit_id if benefit_member and benefit_member.benefit_id else False"/> -->
|
||||
<!-- Main Container -->
|
||||
<table style="background: linear-gradient(to bottom, #ACCFCB 0%, #E0EAE9 50%, #C4B179 100%); width: 297mm; min-height: 210mm; margin: 0 auto; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); padding: 20px 0px 40px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #CCA761; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">اسم الكافل</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.sponsor_id.name if donation_line and donation_line.sponsor_id else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.sponsor_related_id.name"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -65,7 +66,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #CCA761; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">رقم الجوال</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.sponsor_phone if donation_line else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.sponsor_related_id.mobile"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -91,7 +92,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #CCA761; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">اسم اليتيم</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="benefit_member.name if benefit_member else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.name"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -100,7 +101,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #CCA761; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">العمر</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.age if donation_line and donation_line.age else (benefit_member.age if benefit_member and benefit_member.age else '')"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.age"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -112,7 +113,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">رقم الملف</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.benefit_family_code if donation_line and donation_line.benefit_family_code else (doc.code if doc.code else '')"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_code"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -121,7 +122,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">تم الالتحاق في إنسان عام</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.create_date.strftime('%Y') if doc.create_date else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.create_date.strftime('%Y')"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -133,7 +134,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">عدد أفراد الأسرة</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.number_of_family_member if donation_line and donation_line.number_of_family_member else (len(doc.member_ids) if doc.member_ids else '')"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="len(doc.benefit_id.member_ids)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -142,7 +143,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">الجنسية</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="benefit_member.benefit_id.mother_country_id.name if benefit_member and benefit_member.benefit_id and benefit_member.benefit_id.mother_country_id else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_id.father_country_id.name"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -154,7 +155,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">المرحلة الدراسية</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.education_level.name if donation_line and donation_line.education_level else (benefit_member.education_levels.name if benefit_member and benefit_member.education_levels else '')"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.last_education_levels.name if doc.last_education_levels else '-'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -163,7 +164,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">التقدير</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;">-</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.last_education_levels.degree if doc.last_education_levels and doc.last_education_levels.degree else '-'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -175,7 +176,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">الحالة الصحية</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="'يوجد أمراض' if (donation_line and donation_line.diseases_attachment_ids) or (benefit_member and benefit_member.diseases_attachment_ids) else 'طبيعي'"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="'،'.join(doc.diseases_attachment_ids.mapped('diseases_id.name'))"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -184,7 +185,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">نوع السكن</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.housing_id.name if doc.housing_id else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_id.property_type_id.name if doc.benefit_id.property_type_id else '-'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -196,7 +197,17 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">عنوان الأسرة</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.city_id.name if doc.city_id else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;">
|
||||
<t t-esc="' ، '.join(filter(None, [
|
||||
doc.benefit_id.city_id.name,
|
||||
doc.benefit_id.district_id.name,
|
||||
doc.benefit_id.street,
|
||||
doc.benefit_id.house_number,
|
||||
doc.benefit_id.short_number,
|
||||
doc.benefit_id.extra_code,
|
||||
doc.benefit_id.zip
|
||||
]))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -205,7 +216,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">مبلغ الإيجار</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.rent_amount if doc.rent_amount else '0'"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_id.rent_amount if doc.benefit_id.rent_amount else '0'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -217,7 +228,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #136456; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">حالة الأسرة</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_category_id.name if doc.benefit_category_id else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_id.benefit_category_id.name if doc.benefit_id.benefit_category_id else '-'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -226,7 +237,7 @@
|
|||
<table style="width: 100%; height: 40px; border-radius: 30px; outline: 1px solid #136456; background-color: white; border-collapse: collapse;" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td style="width: 50%; height: 40px; background-color: #CCA761; color: white; text-align: center; font-size: 16px; font-weight: bold; border-radius: 30px; padding: 0px 20px; font-family: 'Cairo', Arial, sans-serif;">تاريخ نهاية الكفالة</td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="donation_line.end_date.strftime('%Y-%m-%d') if donation_line and donation_line.end_date else ''"/></td>
|
||||
<td style="width: 50%; text-align: center; font-size: 16px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.sponsorship_end_date.strftime('%Y-%m-%d') if doc.sponsorship_end_date else '-'"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
@ -245,7 +256,7 @@
|
|||
|
||||
<!-- Row 11: Income Sources - Dynamic from salary_ids -->
|
||||
<!-- Get salaries from benefit_id.benefit_id.salary_ids (family.salary_ids) -->
|
||||
<t t-set="family_salaries" t-value="benefit_member.benefit_id.salary_ids if benefit_member and benefit_member.benefit_id else []"/>
|
||||
<t t-set="family_salaries" t-value="doc.benefit_id.salary_ids or []"/>
|
||||
<t t-set="approved_salaries" t-value="family_salaries.filtered(lambda s: s.approved) if family_salaries else []"/>
|
||||
<t t-set="social_security" t-value="approved_salaries.filtered(lambda s: s.income_type and ('ضمان' in s.income_type.name or 'اجتماعي' in s.income_type.name))"/>
|
||||
<t t-set="mother_salary" t-value="approved_salaries.filtered(lambda s: s.is_mother_salary)"/>
|
||||
|
|
@ -315,6 +326,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
|
@ -322,7 +334,7 @@
|
|||
<!-- Report Action for Orphan Report -->
|
||||
<record id="action_report_orphan" model="ir.actions.report">
|
||||
<field name="name">Orphan Report</field>
|
||||
<field name="model">takaful.sponsorship</field>
|
||||
<field name="model">family.member</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">odex_takaful.report_orphan_document</field>
|
||||
<field name="report_file">odex_takaful.report_orphan_document</field>
|
||||
|
|
|
|||
Loading…
Reference in New Issue