Merge remote-tracking branch 'source_origin/dev_odex25_takaful' into dev_odex25_takaful

This commit is contained in:
maltayyar2 2026-01-25 15:45:41 +03:00
commit f3df3a67ee
36 changed files with 1420 additions and 961 deletions

View File

@ -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',
@ -37,12 +38,12 @@
'views/assets.xml',
'views/res_config_settings.xml',
'wizards/orphan_replacement_wizard.xml',
'views/family_member.xml',
'views/takaful_sponorship_view.xml',
'views/donation_item_views.xml',
'views/replacement_reasons_views.xml',
'views/replacement_process_views.xml',
'views/benefit_views.xml',
'views/family_member.xml',
'views/takaful_contribution_view.xml',
'views/sponsorship_payment_view.xml',
@ -83,6 +84,7 @@
'views/product_views.xml',
'views/payment_machine_views.xml',
'views/account_payment_views.xml',
'wizards/global_extension_wizard_view.xml',
'views/takaful_menus_actions.xml',
'views/benefit_category_views.xml',
'data/message_template_data.xml',
@ -90,6 +92,7 @@
'wizards/transfer_deduction_wizard_views.xml',
'reports/transfer_deduction_report.xml',
'reports/transfer_deduction_report_templates.xml',
],
'qweb': [
'static/src/xml/takaful_dashboard.xml',

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="server_action_print_mother_and_orphan_reports" model="ir.actions.server">
<field name="name">Print Mother/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_mother_and_orphan_reports()</field>
</record>
</odoo>

View File

@ -751,6 +751,8 @@ msgstr "مقبوضات الكفالة رقم %s"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__bank_id
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__bank_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__bank_id
#: model_terms:ir.ui.view,arch_db:odex_takaful.benefit_month_payment_report_pdf
#: model_terms:ir.ui.view,arch_db:odex_takaful.benefit_month_payment_share
msgid "Bank"
@ -1185,6 +1187,7 @@ msgstr "هل يمكن جعل الكافل نشطًا مرة أخرى؟"
#: model_terms:ir.ui.view,arch_db:odex_takaful.add_benefit_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.add_details_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.benefit_month_payment_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_history_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.kafalat_cancel_wizard_report_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.kafalat_payment_wizard_report_form
@ -1197,6 +1200,7 @@ msgstr "هل يمكن جعل الكافل نشطًا مرة أخرى؟"
#: model_terms:ir.ui.view,arch_db:odex_takaful.transfer_deduction_wizard_form_view
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_account_payment_register_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_esterdad_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_otp_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_payment_details_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_replacement_wiz_form
@ -1989,8 +1993,9 @@ msgstr "قالب رسالة SMS انتهاء التبرع"
#. module: odex_takaful
#: model:ir.model,name:odex_takaful.model_donation_extension_history
#: model:ir.ui.menu,name:odex_takaful.menu_donation_extension_history
msgid "Donation Extension History"
msgstr "سجل تمديد التبرع"
msgstr "سجلات التمديد"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_res_company__donation_extension_reminder_sms_template_id
@ -2977,6 +2982,7 @@ msgstr "مفوتر"
#: model:ir.model.fields,field_description:odex_takaful.field_sponsorship_payment__invoice_ids
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_sponsorship__invoice_count
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_esterdad_wizard_form
#, python-format
msgid "Invoices"
msgstr "الفواتير"
@ -3093,18 +3099,22 @@ msgstr "تم الإصدار بواسطة"
#. module: odex_takaful
#: model:ir.model,name:odex_takaful.model_account_journal
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_grant_benefit_invoice__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_month_payment__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_payment_details_lines__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_payment_machine__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_points_of_sale_custom__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_payment_method__journal_id
msgid "Journal"
msgstr "دفتر اليومية"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_payment_machine__journal_id
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_payment_method__journal_id
msgid "Journal"
msgstr "بنك الجمعية"
#. module: odex_takaful
#: model:ir.model,name:odex_takaful.model_account_move
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_sponsorship__journal_entry_ids
@ -3204,6 +3214,8 @@ msgstr "مستخدم الكفالات"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment_register__last_digits
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__last_digits
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__last_digits
msgid "Last Digits"
msgstr "رقم الحساب"
@ -4901,6 +4913,11 @@ msgstr "طباعة ورقة البنك"
msgid "Print Excel"
msgstr "طباعة Excel"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_history_form
msgid "Print Extension Receipt"
msgstr "طباعة السند"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.sponsor_report_menu_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.transfer_deduction_wizard_form_view
@ -5940,6 +5957,7 @@ msgstr "تأكيد الكفالة - ${object.sponsor_id.name}"
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__sponsorship_creation_date
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_sponsorship__sponsorship_creation_date
#: model_terms:ir.ui.view,arch_db:odex_takaful.report_transfer_deduction_document
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
#, python-format
msgid "Sponsorship Creation Date"
msgstr "تاريخ الإنشاء"
@ -6956,6 +6974,8 @@ msgid "Yes"
msgstr "نعم"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_account_payment_register_form
msgid "You Can Type 4 Digits"
msgstr "يمكنك إدخال آخر اربعة أرقام"
@ -7466,6 +7486,18 @@ msgstr "شيك"
msgid "Direct Debit"
msgstr "استقطاع"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment__direct_debit
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__direct_debit
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__direct_debit
#: model:ir.model.fields,field_description:odex_takaful.field_sponsorship_scheduling_line__direct_debit
#: model:ir.model.fields.selection,name:odex_takaful.selection__account_payment_register__takaful_payment_method__direct_debit
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__direct_debit_filter__direct
#: model_terms:ir.ui.view,arch_db:odex_takaful.donations_details_lines_view_search
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_sponsorship_scheduling_line_search
msgid "Direct Debit"
msgstr "إستقطاع"
#. module: odex_takaful
#: code:addons/odex_takaful/static/src/xml/takaful_dashboard.xml:0
msgid "Network"
@ -7516,3 +7548,42 @@ msgstr "طريقة السداد (بالاسم)"
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment__payment_method_name
msgid "Payment Method Name"
msgstr "اسم طريقة السداد"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_global_extension_wizard__number_of_months
msgid "Number of Months"
msgstr "أشهر التمديد"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form
msgid "Confirm"
msgstr "تاكيد"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_global_extension_wizard__line_ids
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form
msgid "Donation Lines"
msgstr "الكفالات"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/global_extension_wizard.py:0
#, python-format
msgid "Extend Donation"
msgstr "تمديد الكفالة"
#. module: odex_takaful
#: model:ir.actions.act_window,name:odex_takaful.action_global_extension_wizard
#: model:ir.ui.menu,name:odex_takaful.menu_global_extension_wizard
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_global_extension_wizard_form
msgid "Global Extension"
msgstr "التمديد الشامل"
#. module: odex_takaful
#: model:ir.actions.server,name:odex_takaful.server_action_print_mother_and_orphan_reports
msgid "Print Mother/Orphan Report"
msgstr "طباعة تقرير أم اليتيم/اليتيم"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_account_move_inherit_form
msgid "Previous Payments"
msgstr "المدفوعات السابقة"

View File

@ -31,3 +31,4 @@ from . import donation_replacement_log
from . import payment_machine
from . import benefit_category
from . import mail_message

View File

@ -15,6 +15,9 @@ class AccountMove(models.Model):
payment_id = fields.Many2one('account.payment', string='Payment', copy=False)
esterdad_id = fields.Many2one('esterdad.wizard')
previous_payment_ids = fields.Many2many(related='esterdad_id.payment_ids')
sponsorship_cancel_reason = fields.Text(readonly=True)
def action_view_esterdad_id(self):
self.ensure_one()

View File

@ -143,6 +143,17 @@ class DonationsDetailsLines(models.Model):
)
payment_method_type = fields.Selection(related='payment_method_display.payment_method', string='Payment Method Type', store=True)
benefit_kafala_status = fields.Selection(related='benefit_id.kafala_status', string="Benefit Kafala Status")
show_last_digits = fields.Boolean(string="Use 4 Digits", )
last_digits = fields.Char(string="Last Digits", size=32)
bank_id = fields.Many2one('res.bank', string="Bank")
@api.onchange("direct_debit_partner_bank_id")
def onchange_direct_debit_partner_bank_id(self):
for rec in self:
if rec.direct_debit_partner_bank_id:
rec.show_last_digits = False
else:
rec.show_last_digits = True
@api.onchange('family_id')
@ -1424,3 +1435,14 @@ class DonationsDetailsLines(models.Model):
'default_donation_detail_id': self.id,
},
}
@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
if self.env.context.get('wizard_force_show_all'):
self = self.sudo()
return super(DonationsDetailsLines, self).search(args, offset, limit, order, count)
def read(self, fields=None, load='_classic_read'):
if self.env.context.get('wizard_force_show_all'):
self = self.sudo()
return super(DonationsDetailsLines, self).read(fields, load)

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from dateutil.relativedelta import relativedelta
class DonationExtensionHistory(models.Model):
@ -106,6 +107,7 @@ class DonationExtensionHistory(models.Model):
state = fields.Selection([
('active', 'Active'),
('wait_pay', 'Wait Pay'),
('paid', 'Paid'),
('cancel', 'Canceled')
], string='State', default='active', tracking=True)
@ -125,6 +127,74 @@ class DonationExtensionHistory(models.Model):
store=False
)
direct_debit_partner_bank_id = fields.Many2one("res.partner.bank")
debit_payment_file_attachment = fields.Binary(attachment=True)
debit_payment_attachment_file_name = fields.Char()
journal_id = fields.Many2one('account.journal')
last_digits = fields.Char()
bank_id = fields.Many2one('res.bank')
paid_amount = fields.Float()
def _apply_extension_on_sponsorship(self):
new_end_date = self.donation_detail_id.end_date + relativedelta(months=self.extension_months)
donation_line_new_vals = {
'end_date': new_end_date,
'payment_month_count': self.donation_detail_id.payment_month_count + self.extension_months,
}
if self.new_direct_debit:
donation_line_new_vals.update({
'direct_debit': self.new_direct_debit,
'direct_debit_partner_bank_id': self.direct_debit_partner_bank_id.id,
'journal_id': self.journal_id.id,
'debit_payment_file_attachment': self.debit_payment_file_attachment,
'debit_payment_attachment_file_name': self.debit_payment_attachment_file_name,
'last_digits': self.last_digits,
'bank_id': self.bank_id.id,
})
self.donation_detail_id.write(donation_line_new_vals)
benefit_ids = self.donation_detail_id.benefit_ids | self.donation_detail_id.benefit_id
benefit_ids.write({
'sponsorship_end_date': new_end_date,
'kafala_status': 'have_kafala',
})
# Create new scheduling lines for the extension period
if self.new_direct_debit:
self._create_extension_scheduling_lines()
def _create_extension_scheduling_lines(self):
self.ensure_one()
donation_line = self.donation_detail_id
start_date = donation_line.end_date + relativedelta(months=1)
# Distribute total amount across months
base_amount, remainder = divmod(self.extension_amount, self.extension_months)
base_amount = float(base_amount)
for month in range(self.extension_months):
scheduled_date = start_date + relativedelta(months=month)
month_year = scheduled_date.strftime("%m/%Y")
# Distribute remainder across first months
amount = base_amount + 1 if month < remainder else base_amount
# Format the amount to 2 decimal places for better representation
amount = round(amount, 2)
# Create scheduling line
self.env['sponsorship.scheduling.line'].sudo().create({
'sponsorship_id': donation_line.sponsorship_id.id or donation_line.sponsorship_mechanism_id.id,
'donation_detail_linked_id': donation_line.id,
'beneficiary_id': donation_line.benefit_id.id if donation_line.benefit_id else False,
'month_year': month_year,
'scheduled_date': scheduled_date,
'amount': amount,
'status': 'unpaid',
})
def _sms_get_number_fields(self):
"""Return fields to use for SMS phone number"""
return ['sponsor_phone']
@ -172,7 +242,7 @@ class DonationExtensionHistory(models.Model):
'context': {
'active_model': 'account.move',
'active_ids': self.invoice_id.ids,
'default_amount': self.extension_amount,
'default_amount': self.extension_amount - self.paid_amount,
'sponsorship_payment_skip_compute_amount': True,
'dont_redirect_to_payments': True,
'sponsorship_line_ids': self.donation_detail_id.ids,
@ -188,6 +258,23 @@ class DonationExtensionHistory(models.Model):
'type': 'ir.actions.act_window',
}
def action_cancel_invoice(self):
self.ensure_one()
self.sudo().invoice_id.button_draft()
self.sudo().invoice_id.button_cancel()
if self.new_direct_debit:
scheduling_lines = self.env['sponsorship.scheduling.line'].search([
('donation_detail_linked_id', '=', self.donation_detail_id.id),
('scheduled_date', '>', self.old_end_date)
])
scheduling_lines.sudo().unlink()
self.write({
'state': 'cancel'
})
def action_print_extension_receipt(self):
"""Print the extension receipt PDF report."""
self.ensure_one()

View File

@ -59,6 +59,9 @@ class FamilyMember(models.Model):
allowed_sponsorship = fields.Boolean(related='benefit_id.benefit_category_id.allowed_sponsorship')
def server_action_print_mother_and_orphan_reports(self):
return self.env.ref('odex_takaful.action_report_mother_and_orphan').report_action(self)
def name_get(self):
result = []
show_age = self.env.context.get('show_age_in_kafalat')

View File

@ -0,0 +1,12 @@
from odoo import models, api
class Message(models.Model):
_inherit = 'mail.message'
@api.model
def _find_allowed_model_wise(self, doc_model, doc_dict):
doc_ids = list(doc_dict)
allowed_doc_ids = self.env[doc_model].with_context(active_test=False).search([('id', 'in', doc_ids)]).ids
return set([message_id for allowed_doc_id in allowed_doc_ids if allowed_doc_id in doc_dict for message_id in doc_dict[allowed_doc_id]])

View File

@ -158,6 +158,13 @@ class SchedulingLine(models.Model):
elif line.donation_detail_linked_id.state != 'waiting' and line.donation_detail_linked_id.record_type != 'donation' and line.donation_detail_linked_id.record_type == 'sponsorship':
line.donation_detail_linked_id.sudo().write({'state': 'active'})
line.donation_detail_linked_id.sponsorship_id.sudo().write({'state': 'wait_pay'})
histories = self.env['donation.extension.history'].sudo().search([
('donation_detail_id', '=', line.donation_detail_linked_id.id),
('old_end_date', '<', line.scheduled_date),
('new_end_date', '>=', line.scheduled_date)
])
if len(histories):
histories.write({'state': 'wait_pay'})
_logger.info(f"Successfully processed scheduled payment for line {line.sequence_no}")

View File

@ -330,9 +330,9 @@ class TakafulSponsorship(models.Model):
context = dict(self.env.context or {})
context['default_sponsor_id'] = rec.id
context['default_pay_date'] = rec.pay_date
context['default_amount'] = rec.total_sponsorship_amount
# context['default_amount'] = rec.total_sponsorship_amount
context['default_sponsor_name'] = rec.sponsor_id.first_name
context['default_mobile'] = rec.sponsor_id.mobile
context['default_mobile'] = rec.sponsor_phone
context['default_id_num'] = rec.sponsor_id.id_number
# context['default_payment_ids'] = rec.payment_ids.ids
view = self.env.ref('odex_takaful.view_esterdad_wizard_form')
@ -349,13 +349,11 @@ class TakafulSponsorship(models.Model):
else:
raise UserError(_("You cannot do this. The refund period has expired."))
@api.depends('sponsor_id','sponsor_id.mobile')
@api.depends('sponsor_id', 'sponsor_id.mobile')
def _compute_sponsor_phone(self):
for rec in self:
if rec.sponsor_id.id != rec.env.company.faal_kheer_partner_id.id:
rec.sponsor_phone = rec.sponsor_id.mobile if rec.sponsor_id else False
for rec in self.filtered(lambda r: r.state in ['draft']):
if rec.sponsor_or_donor_type == 'registered':
rec.sponsor_phone = rec.sponsor_id.mobile
def compute_days_after_payment(self):
"""Check if the number of hours passed after payment is within the configured limit"""
@ -1057,7 +1055,7 @@ class TakafulSponsorship(models.Model):
rec.sponsor_donor_type = 'registered'
# Update related fields from selected sponsor
rec.sponsor_phone = rec.sponsor_id.mobile
# rec.sponsor_phone = rec.sponsor_id.mobile
rec.preferred_communication = rec.sponsor_id.preferred_communication
@api.model
@ -1659,7 +1657,11 @@ class TakafulSponsorship(models.Model):
else:
pass
#self.action_send_whatsapp()
direct_debit_sponsorship_line_ids = (self.donations_details_lines | self.donations_details_lines_mechanism_ids).filtered(
lambda l: l.direct_debit)
for dd_line in direct_debit_sponsorship_line_ids:
for sched_line in dd_line.sponsorship_scheduling_line_ids:
sched_line.cron_process_scheduled_payments()
def action_send_whatsapp(self):
config = self.env['ir.config_parameter'].sudo()

View File

@ -5,99 +5,98 @@
<!-- 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 -->
<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">
<t t-if="sponsorship">
<!-- Reuse sale order header layout -->
<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 style="position: relative; z-index: 1;">
<div class="oe_structure"/>
<div style="position: relative; z-index: 1;">
<div class="oe_structure"/>
<!-- Greeting / intro -->
<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="sponsorship.sponsor_name or sponsorship.sponsor_id.name"/>
<!-- Greeting / intro -->
<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="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 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 -->
<div style="text-align: right; margin-bottom: 20px;">
<div style="font-size: 1.3rem; color: #8F9090;">
<span style="font-weight: bold;">رقم الكفالة: </span>
<t t-esc="sponsorship.code"/>
<!-- Extension info -->
<div style="text-align: right; margin-bottom: 20px;">
<div style="font-size: 1.3rem; color: #8F9090;">
<span style="font-weight: bold;">رقم الكفالة: </span>
<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 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 -->
<table class="table table-bordered" style="text-align: right;">
<thead>
<tr style="background-color: #f8f9fa;">
<th style="text-align: right; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
نوع التبرع
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
التفاصيل
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
الفترة الجديدة
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ
</th>
</tr>
</thead>
<tbody>
<t t-foreach="all_extensions" t-as="ext">
<!-- Extension Lines table -->
<table class="table table-bordered" style="text-align: right;">
<thead>
<tr style="background-color: #f8f9fa;">
<th style="text-align: right; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
نوع التبرع
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
التفاصيل
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
الفترة الجديدة
</th>
<th style="text-align: center; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ
</th>
</tr>
</thead>
<tbody>
<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,100 +105,100 @@
</t>
</td>
</tr>
</t>
<!-- Summary Row: المجموع -->
<tr style="background-color: #f8f9fa;">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<strong>المجموع:</strong>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong>
</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-if="total_amt == int(total_amt)">
<span t-esc="'{:,.0f}'.format(total_amt)"/> <small>ر.س</small>
</t>
<t t-else="">
<span t-esc="'{:,.2f}'.format(total_amt)"/> <small>ر.س</small>
</t>
</strong>
</td>
</tr>
</tbody>
</table>
<!-- Summary Row: المجموع -->
<tr style="background-color: #f8f9fa;">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<strong>المجموع:</strong>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.4rem; color: #387F75; font-weight: bold;">
<strong>-</strong>
</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="o.extension_amount"/>
<t t-if="total_amt == int(total_amt)">
<span t-esc="'{:,.0f}'.format(total_amt)"/> <small>ر.س</small>
</t>
<t t-else="">
<span t-esc="'{:,.2f}'.format(total_amt)"/> <small>ر.س</small>
</t>
</strong>
</td>
</tr>
</tbody>
</table>
<!-- Payments table: وسيلة الدفع والمبلغ -->
<table class="table table-bordered" style="text-align: right; margin-top: 12px;">
<thead>
<tr style="background-color: #f8f9fa;">
<th style="text-align: right; width: 75%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
وسيلة الدفع
</th>
<th style="text-align: center; width: 25%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ
</th>
</tr>
</thead>
<tbody>
<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">
<tr>
<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"/>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<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="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-set="pay_amt" t-value="pay_amt + partial.amount"/>
<!-- Payments table: وسيلة الدفع والمبلغ -->
<table class="table table-bordered" style="text-align: right; margin-top: 12px;">
<thead>
<tr style="background-color: #f8f9fa;">
<th style="text-align: right; width: 75%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
وسيلة الدفع
</th>
<th style="text-align: center; width: 25%; font-size: 1.4rem; padding: 8px; color: #6B6B6A; font-weight: bold;">
المبلغ
</th>
</tr>
</thead>
<tbody>
<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">
<tr>
<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"/>
</td>
<td style="text-align: center; padding: 8px; font-size: 1.3rem; color: #387F75;">
<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="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-set="pay_amt" t-value="pay_amt + partial.amount"/>
</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 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>
<tr style="background-color: #f8f9fa;">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<strong>
<span style="margin-left: 10px;">الإجمالي:</span>
</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="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>
</tr>
</t>
<tr style="background-color: #f8f9fa;">
<td style="text-align: right; padding: 8px; font-size: 1.4rem; color: #6B6B6A; font-weight: bold;">
<strong>
<span style="margin-left: 10px;">الإجمالي:</span>
</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-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>
</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>
<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>

View File

@ -12,322 +12,374 @@
<field name="margin_left">0</field>
<field name="margin_right">0</field>
<field name="header_spacing">0</field>
<field name="dpi">100</field>
</record>
<!-- Orphan Report Template -->
<template id="report_orphan_document">
<template id="report_mother_and_orphan_document">
<t t-call="web.html_container">
<t t-set="base_url" t-value="'http://%s' % request.httprequest.host"/>
<style>
@font-face {
font-family: 'Cairo';
src: url('<t t-esc="base_url"/>/odex_takaful/static/src/fonts/Cairo-Regular.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Cairo';
src: url('<t t-esc="base_url"/>/odex_takaful/static/src/fonts/Cairo-SemiBold.ttf') format('truetype');
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: 'Cairo';
src: url('<t t-esc="base_url"/>/odex_takaful/static/src/fonts/Cairo-Bold.ttf') format('truetype');
font-weight: 700;
font-style: normal;
}
@page {
size: A4 landscape;
margin: 0 !important;
}
body {
margin: 0 !important;
padding: 0 !important;
}
.orphan-page {
direction: rtl !important;
font-family: 'Cairo', Arial, sans-serif !important;
width: 100% !important;
height: 273mm;
background: -webkit-linear-gradient(top, #ACCFCB 0%, #E0EAE9 50%, #C4B179 100%) !important;
background: linear-gradient(to bottom, #ACCFCB 0%, #E0EAE9 50%, #C4B179 100%) !important;
position: relative;
}
.orphan-page table {
direction: rtl !important;
border-collapse: collapse !important;
width: 100% !important;
table-layout: fixed !important;
}
.orphan-page td {
direction: rtl !important;
}
.orphan-page .data-items-row {
display: table-row !important;
width: 100% !important;
}
.orphan-page .data-item-col {
display: table-cell !important;
width: 50% !important;
vertical-align: top !important;
}
.orphan-page .data-item-spacer {
display: table-cell !important;
width: 4% !important;
}
.orphan-page .data-row-table {
box-shadow: 0 0 0 1px #136456 !important;
background-color: white !important;
border-radius: 30px !important;
overflow: hidden !important;
}
.orphan-page .label-cell {
background-color: #CCA761 !important;
color: white !important;
}
.orphan-page .label-cell-dark {
background-color: #136456 !important;
color: white !important;
}
</style>
<t t-foreach="docs" t-as="doc">
<!-- 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="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"/>
<!-- 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>
<td>
<!-- Header Section -->
<table style="width: 100%; margin-bottom: 15px; padding: 0px 0px 0px 20px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: right; vertical-align: middle;">
<table style="background-color: #22B6B3; border-radius: 30px 0px 0px 30px; padding: 10px 15px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td style="text-align: center;">
<h1 style="font-size: 20px; font-weight: bold; color: white; margin: 0px; font-family: 'Cairo', Arial, sans-serif; padding: 5px 15px;">تقرير اليتيم</h1>
</td>
</tr>
</table>
</td>
<td style="width: 120px; vertical-align: middle;">
<img src="/odex_takaful/static/src/img/ensan-logo.png" alt="Logo" style="width: 100px; height: auto; max-height: 100px; display: block;"/>
</td>
</tr>
</table>
<div class="page orphan-page" dir="rtl" lang="ar" t-att-style="'page-break-after: always;' if not doc_last else ''">
<table style="width: 100%; margin: 0; padding: 20px 0px 20px; border-collapse: collapse; direction: rtl;" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align: top;">
<table style="width: 100%; margin-bottom: 30px; padding: 0px 40px; border-collapse: collapse; direction: rtl;" cellpadding="0" cellspacing="0">
<tr>
<td style="width: auto; text-align: right; vertical-align: middle; padding: 40px 0px 0px; white-space: nowrap;">
<h1 style="font-size: 20px; font-weight: bold; color: white; padding: 10px 20px 10px 30px; margin: 0px; font-family: 'Cairo', Arial, sans-serif; white-space: nowrap; border-radius: 30px 0px 0px 30px; background-color: #22B6B3;">تقرير <t t-if="doc.relationn.relation_type == 'mother'" t-esc="'أم'"/> اليتيم</h1>
</td>
<td style="width: 78%;"></td>
<td style="width: auto; text-align: left; vertical-align: middle; padding-top: 20px; padding-left: 10px;">
<img t-attf-src="http://{{request.httprequest.host}}/odex_takaful/static/src/img/ensan-logo.png" alt="Logo" style="width: 100px; height: auto; max-height: 100px; display: block;"/>
</td>
</tr>
</table>
<!-- Body Section -->
<table style="width: 100%; padding: 0px 40px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td>
<!-- Data Items Container -->
<table style="width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<!-- Row 1: اسم الكافل + رقم الجوال -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<table style="width: 100%; padding: 0px 40px; border-collapse: collapse; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td>
<table style="width: 100%; border-collapse: collapse; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; border-radius: 30px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; overflow: hidden; direction: rtl;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell" style="width: 48%; height: 40px; background-color: #CCA761 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">اسم الكافل</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif; padding: 0px 10px;"><t t-esc="doc.sponsor_related_id.name if doc.sponsor_related_id else ''"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table style="width: 100%; height: 40px; border-radius: 30px; box-shadow: 0 0 0 1px #136456; background-color: white; border-collapse: separate; border-spacing: 0; overflow: hidden; direction: rtl;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell" style="width: 48%; height: 40px; background-color: #CCA761 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">رقم الجوال</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.sponsor_related_id.mobile"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 2: Description -->
<tr>
<td colspan="3" style="padding: 2.5px;">
<table style="width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td>
<p style="font-size: 16px; color: #136456; text-align: start; font-weight: bold; margin: 5px 0px 0px; padding: 0px 40px; font-family: 'Cairo', Arial, sans-serif;">حين يصبح الأثر إنسانًا له اسم وقصة وابتسامة.. <br/> نعلم أن الكفالة ليست نهاية، بل بداية لعطاء مستدام، وأثر يصنع الفرق.</p>
<span style="font-size: 16px; color: #136456; text-align: start; font-weight: normal; margin: 10px 0px; padding: 0px 40px; font-family: 'Cairo', Arial, sans-serif;">ما بين الصفوف الدراسية، والهوايات الصغيرة والأمنيات البسيطة، نرفق لكم تقرير مفصل عن اليتيم المكفول:</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" style="padding: 15px 0px;">
<table style="width: 100%; border-collapse: collapse; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td>
<p style="font-size: 14px; color: #136456; text-align: start; font-weight: bold; margin: 5px 0px 0px; padding: 0px 40px; font-family: 'Cairo', Arial, sans-serif;">حين يصبح الأثر إنسانًا له اسم وقصة وابتسامة.. <br/> نعلم أن الكفالة ليست نهاية، بل بداية لعطاء مستدام، وأثر يصنع الفرق.</p>
<span style="font-size: 14px; color: #136456; text-align: start; font-weight: normal; margin: 10px 0px; padding: 0px 40px; font-family: 'Cairo', Arial, sans-serif;">ما بين الصفوف الدراسية، والهوايات الصغيرة والأمنيات البسيطة، نرفق لكم تقرير مفصل عن اليتيم المكفول:</span>
</td>
</tr>
</table>
</td>
</tr>
<!-- Row 3: اسم الأرملة + العمر -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table style="width: 100%; height: 40px; border-radius: 30px; box-shadow: 0 0 0 1px #136456; background-color: white; border-collapse: separate; border-spacing: 0; overflow: hidden; direction: rtl;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell" style="width: 48%; height: 40px; background-color: #CCA761 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">
<t t-if="doc.relationn.relation_type == 'mother'">
اسم الأرملة
</t>
<t t-else="1">
اسم اليتيمـ/ـة
</t>
</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.mother_first_name if doc.mother_first_name else doc.member_first_name if doc.member_first_name else '-' "/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell" style="width: 48%; height: 40px; background-color: #CCA761 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">العمر</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.age"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 4: رقم الملف + تم الالتحاق في إنسان عام -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">رقم الملف</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_code"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">تم الالتحاق في إنسان عام</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.create_date.strftime('%Y')"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 5: عدد أفراد الأسرة + الجنسية -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">عدد أفراد الأسرة</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="len(doc.benefit_id.member_ids)"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">الجنسية</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.benefit_id.mother_country_id.name if doc.relationn.relation_type == 'mother' else doc.benefit_id.father_country_id.name"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 6: المرحلة الدراسية + التقدير -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">المرحلة الدراسية</td>
<td style="width: 52%; text-align: center; font-size: 14px; 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>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">التقدير</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="doc.last_degree if doc.last_degree else '-'"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 7: الحالة الصحية + نوع السكن -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">الحالة الصحية</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="'،'.join(doc.diseases_attachment_ids.mapped('diseases_id.name')) if len(doc.diseases_attachment_ids) else 'سليم'"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">نوع السكن</td>
<td style="width: 52%; text-align: center; font-size: 14px; 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>
</tr>
<!-- Row 8: عنوان الأسرة + مبلغ الإيجار -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">عنوان الأسرة</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;">
<t t-esc="doc.benefit_id.city_id.name if doc.benefit_id.city_id else '-' "/>
</td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">مبلغ الإيجار</td>
<td style="width: 52%; text-align: center; font-size: 14px; 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 '-'"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 9: حالة الأسرة + تاريخ نهاية الكفالة -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">حالة الأسرة</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="'فقيرة ومحتاجة'"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell" style="width: 48%; height: 40px; background-color: #CCA761 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">تاريخ نهاية الكفالة</td>
<td style="width: 52%; text-align: center; font-size: 14px; 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>
</tr>
<!-- Row 10: Section Title - مصادر دخل الأسرة -->
<tr>
<td colspan="3" style="padding: 2.5px 40px;">
<table style="width: 100%; height: 40px; background-color: #CCA761; border-radius: 30px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tr>
<td style="font-size: 16px; color: white; text-align: start; padding: 0px 20px; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;">مصادر دخل الأسرة</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3" style="padding: 8px 35px;">
<table style="width: 100%; height: 40px; background-color: #CCA761 !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td style="font-size: 15px; color: white; text-align: start; padding: 0px 20px; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;">مصادر دخل الأسرة</td>
</tr>
</table>
</td>
</tr>
<!-- 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="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)"/>
<t t-set="retirement" t-value="approved_salaries.filtered(lambda s: s.income_type and 'تقاعد' in s.income_type.name)"/>
<t t-set="social_insurance" t-value="approved_salaries.filtered(lambda s: s.income_type and 'تأمين' in s.income_type.name)"/>
<t t-set="total_income" t-value="sum(approved_salaries.mapped('salary_amount')) if approved_salaries else (benefit_member.member_income if benefit_member and benefit_member.member_income else 0)"/>
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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="sum(social_security.mapped('salary_amount')) if social_security else '-'"/></td>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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="sum(mother_salary.mapped('salary_amount')) if mother_salary else '-'"/></td>
</tr>
</table>
</td>
</tr>
<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 len(family_salaries) else []"/>
<t t-set="social_security" t-value="approved_salaries.filtered(lambda s: s.income_type and s.income_type.name == 'الضمان الاجتماعي').mapped('salary_amount') if len(approved_salaries) else []"/>
<t t-set="mother_salary" t-value="approved_salaries.filtered(lambda s: s.is_mother_salary).mapped('salary_amount') if len(approved_salaries) else []"/>
<t t-set="retirement" t-value="approved_salaries.filtered(lambda s: s.income_type and s.income_type.name == 'راتب تقاعدي').mapped('salary_amount') if len(approved_salaries) else []"/>
<t t-set="social_insurance" t-value="approved_salaries.filtered(lambda s: s.income_type and s.income_type.name == '').mapped('salary_amount') if len(approved_salaries) else []"/>
<t t-set="total_income" t-value="sum(social_security + mother_salary + retirement + social_insurance)"/>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">الضمان الاجتماعي</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="sum(social_security) if len(social_security) else '-'"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">راتب الأم</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="sum(mother_salary) if len(mother_salary) else '-'"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 12: الراتب التقاعدي + التأمينات الاجتماعية -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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="sum(retirement.mapped('salary_amount')) if retirement else '-'"/></td>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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="sum(social_insurance.mapped('salary_amount')) if social_insurance else '-'"/></td>
</tr>
</table>
</td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 9px 35px 10px 15px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">الراتب التقاعدي</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="sum(retirement) if len(retirement) else '-'"/></td>
</tr>
</table>
</td>
<td class="data-item-col" style="width: 50%; padding: 9px 15px 10px 35px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">التأمينات الاجتماعية</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="sum(social_insurance) if len(social_insurance) else '-'"/></td>
</tr>
</table>
</td>
</tr>
<!-- Row 13: المجموع (single item) -->
<tr>
<td style="width: 48%; padding: 2.5px 40px; vertical-align: top;">
<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="total_income if total_income else '-'"/></td>
</tr>
</table>
</td>
<td style="width: 4%;"></td>
<td style="width: 48%; padding: 2.5px; vertical-align: top;"></td>
</tr>
<tr class="data-items-row">
<td class="data-item-col" style="width: 50%; padding: 8px 35px 35px 20px; vertical-align: top;">
<table class="data-row-table" style="width: 100%; height: 40px; box-shadow: 0 0 0 1px #136456; background-color: white !important; border-collapse: separate; border-spacing: 0; border-radius: 30px; overflow: hidden; direction: rtl; table-layout: fixed;" cellpadding="0" cellspacing="0">
<tr>
<td class="label-cell-dark" style="width: 48%; height: 40px; background-color: #136456 !important; color: white !important; text-align: center; font-size: 15px; font-weight: bold; padding: 5px 15px; font-family: 'Cairo', Arial, sans-serif; border-radius: 30px 0px 0px 30px; overflow: hidden;">المجموع</td>
<td style="width: 52%; text-align: center; font-size: 14px; color: #136456; font-weight: bold; font-family: 'Cairo', Arial, sans-serif;"><t t-esc="total_income if total_income else '-'"/></td>
</tr>
</table>
</td>
<td style="width: 2%;"></td>
<td style="width: 50%; padding: 5px; vertical-align: top;"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</t>
</t>
</template>
<!-- Report Action for Orphan Report -->
<record id="action_report_orphan" model="ir.actions.report">
<record id="action_report_mother_and_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>
<field name="report_name">odex_takaful.report_mother_and_orphan_document</field>
<field name="report_file">odex_takaful.report_mother_and_orphan_document</field>
<field name="print_report_name">
(object.code and ('Orphan Report - %s' % (object.code,))) or 'Orphan Report'
(object.benefit_code and ('Mother/Orphan Report - %s' % (object.benefit_code,))) or 'Orphan Report'
</field>
<field name="paperformat_id" ref="paperformat_orphan_landscape"/>
<field name="binding_model_id" eval="False"/>

View File

@ -136,7 +136,12 @@
<t t-elif="doc.record_type == 'sponsorship'">
<span t-esc="(line.benefit_id.name or '').split()[0] if line.benefit_id else '-'"/> - <span t-esc="line.benefit_family_code or '-'"/>
<br/>
<small style="color: #8F9090;"><span t-esc="original_months"/> شهر</small>
<t t-if="line.sponsorship_duration != 'permanent'">
<small style="color: #8F9090;">
<span t-esc="original_months"/> شهر
</small>
</t>
</t>
</td>

View File

@ -1,63 +1,58 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sponsorship_payment_user,Full access on sponsorship.payment to Payment User,model_sponsorship_payment,group_kufula_user,1,1,1,1
access_month_payment_full,Full access on month.payment to Month Payment Manager,model_month_payment,odex_takaful.group_kufula_user,1,1,1,1
access_takaful_message_template,Full access on takaful.message.template,model_takaful_message_template,odex_takaful.group_kufula_user,1,1,1,1
access_sponsorship_cancellation,Full access on sponsorship.cancellation,model_sponsorship_cancellation,odex_takaful.group_kufula_user,1,1,1,1
access_takaful_contribution,Full access on takaful.contribution,model_takaful_contribution,odex_takaful.group_kufula_user,1,1,1,1
access_takaful_push_notification,Full access on takaful.push.notification,model_takaful_push_notification,odex_takaful.group_kufula_user,1,1,1,1
access_month_payment_line,Full access on month.payment.line,model_month_payment_line,odex_takaful.group_kufula_user,1,1,1,1
access_sponsorship_benefit_arrears,Full access on sponsorship.benefit.arrears,model_sponsorship_benefit_arrears,odex_takaful.group_kufula_user,1,1,1,1
access_sponsorship_reason_stop,Full access on sponsorship.reason.stop,model_sponsorship_reason_stop,odex_takaful.group_kufula_user,1,1,1,1
access_donate_for_another_person,access_donate_for_another_person,model_donate_for_another_person,odex_takaful.group_kufula_user,1,1,1,1
access_donations_items,access_donations_items,model_donations_items,odex_takaful.group_kufula_user,1,1,1,1
access_replacement_reasons,access_replacement_reasons,model_replacement_reasons,odex_takaful.group_orphan_replacement,1,1,1,1
access_replacement_process,access_replacement_process,model_replacement_process,odex_takaful.group_orphan_replacement,1,1,1,0
access_sponsorship_payment_user,Full access on sponsorship.payment,model_sponsorship_payment,group_kufula_user,1,1,1,1
access_month_payment_full,Full access on month.payment,model_month_payment,group_kufula_user,1,1,1,1
access_takaful_message_template,Full access on takaful.message.template,model_takaful_message_template,group_kufula_user,1,1,1,1
access_sponsorship_cancellation,Full access on sponsorship.cancellation,model_sponsorship_cancellation,group_kufula_user,1,1,1,1
access_takaful_contribution,Full access on takaful.contribution,model_takaful_contribution,group_kufula_user,1,1,1,1
access_takaful_push_notification,Full access on takaful.push.notification,model_takaful_push_notification,group_kufula_user,1,1,1,1
access_month_payment_line,Full access on month.payment.line,model_month_payment_line,group_kufula_user,1,1,1,1
access_sponsorship_benefit_arrears,Full access on sponsorship.benefit.arrears,model_sponsorship_benefit_arrears,group_kufula_user,1,1,1,1
access_sponsorship_reason_stop,Full access on sponsorship.reason.stop,model_sponsorship_reason_stop,group_kufula_user,1,1,1,1
access_donate_for_another_person,access_donate_for_another_person,model_donate_for_another_person,group_kufula_user,1,1,1,1
access_donations_items,access_donations_items,model_donations_items,group_kufula_user,1,1,1,1
access_replacement_reasons,access_replacement_reasons,model_replacement_reasons,group_orphan_replacement,1,1,1,1
access_replacement_process,access_replacement_process,model_replacement_process,group_orphan_replacement,1,1,1,0
access_takaful_notification,access_takaful_notification,model_takaful_notification,,1,1,1,1
access_sponsorship_states,access_sponsorship_states,model_sponsorship_states,,1,1,1,1
access_replacement_wiz,access_replacement_wiz,model_replacement_wiz,,1,1,1,1
access_donations_details_lines,access_donations_details_lines,model_donations_details_lines,odex_takaful.group_kufula_user,1,1,1,1
access_refund_details_lines,access_refund_details_lines,model_refund_details_lines,odex_takaful.group_kufula_user,1,1,1,1
access_points_of_sale_custom,access_points_of_sale_custom,model_points_of_sale_custom,odex_takaful.group_kufula_user,1,1,1,1
access_payment_details_lines,access_payment_details_lines,model_payment_details_lines,odex_takaful.group_kufula_user,1,1,1,1
access_sponsorship_scheduling_line,access_sponsorship_scheduling_line,model_sponsorship_scheduling_line,odex_takaful.group_kufula_user,1,0,0,0
access_refund_reasons,access_refund_reasons,model_refund_reasons,odex_takaful.group_kufula_user,1,1,1,1
access_takaful_sponsorship_user,Full access on takaful.sponsorship to Sponsorship User,model_takaful_sponsorship,group_kufula_user,1,1,1,1
access_res_partner_user,Access on res.pfartner to Sponsorship User,base.model_res_partner,group_kufula_user,1,1,0,0
access_res_users_user,Access on res.users to Sponsorship User,base.model_res_users,group_kufula_user,1,1,0,0
access_grant_benefit_invoice,Full access on grant.benefit.invoice to Month Payment Manager,model_grant_benefit_invoice,base.group_user,1,1,1,1
access_donations_details_lines,access_donations_details_lines,model_donations_details_lines,group_kufula_user,1,1,1,1
access_refund_details_lines,access_refund_details_lines,model_refund_details_lines,group_kufula_user,1,1,1,1
access_points_of_sale_custom,access_points_of_sale_custom,model_points_of_sale_custom,group_kufula_user,1,1,1,1
access_payment_details_lines,access_payment_details_lines,model_payment_details_lines,group_kufula_user,1,1,1,1
access_sponsorship_scheduling_line,access_sponsorship_scheduling_line,model_sponsorship_scheduling_line,group_kufula_user,1,0,0,0
access_refund_reasons,access_refund_reasons,model_refund_reasons,group_kufula_user,1,1,1,1
access_takaful_sponsorship_user,Full access on takaful.sponsorship,model_takaful_sponsorship,group_kufula_user,1,1,1,1
access_res_partner_user,Access on res.partner,base.model_res_partner,group_kufula_user,1,1,0,0
access_res_users_user,Access on res.users,base.model_res_users,group_kufula_user,1,1,0,0
access_grant_benefit_invoice,Full access on grant.benefit.invoice,model_grant_benefit_invoice,base.group_user,1,1,1,1
access_refund_wiz,access_refund_wiz,model_refund_wiz,,1,1,1,1
access_add_details_wiz,access_add_details_wiz,model_add_details_wiz,,1,1,1,1
access_preferred_communication,access_preferred_communication,model_preferred_communication,,1,1,1,1
access_takaful_payment_method,access_takaful_payment_method,model_takaful_payment_method,,1,1,1,1
access_replacement_line_method,access_takaful_replacement_line,model_replacement_line,,1,1,1,1
access_replacement_process_line_method,access_takaful_replacement_process_line,model_replacement_process_line,,1,1,1,1
access_transfer_deduction_wizard,transfer.deduction.wizard.access,model_transfer_deduction_wizard,base.group_user,1,1,1,1
access_account_payment_register_donation_officer,account_payment_register_donation_officer,account.model_account_payment_register,odex_takaful.donation_officer_group,1,1,1,0
access_product_template_donation_officer,product_template_donation_officer,product.model_product_template,odex_takaful.donation_officer_group,1,1,1,0
access_product_product_donation_officer,product_product_donation_officer,product.model_product_product,odex_takaful.donation_officer_group,1,1,1,0
access_group_kufula_user_account_payment,access_group_kufula_user_account_payment,account.model_account_payment,odex_takaful.group_kufula_user,1,1,1,0
access_group_kufula_user_account_partial_reconcile,access_group_kufula_user_account_partial_reconcile,account.model_account_partial_reconcile,odex_takaful.group_kufula_user,1,1,1,0
access_group_kufula_user_account_full_reconcile,access_group_kufula_user_account_full_reconcile,account.model_account_full_reconcile,odex_takaful.group_kufula_user,1,1,1,0
access_account_payment_register_donation_officer,account_payment_register_donation_officer,account.model_account_payment_register,donation_officer_group,1,1,1,0
access_product_template_donation_officer,product_template_donation_officer,product.model_product_template,donation_officer_group,1,1,1,0
access_product_product_donation_officer,product_product_donation_officer,product.model_product_product,donation_officer_group,1,1,1,0
access_group_kufula_user_account_payment,access_group_kufula_user_account_payment,account.model_account_payment,group_kufula_user,1,1,1,0
access_group_kufula_user_account_partial_reconcile,access_group_kufula_user_account_partial_reconcile,account.model_account_partial_reconcile,group_kufula_user,1,1,1,0
access_group_kufula_user_account_full_reconcile,access_group_kufula_user_account_full_reconcile,account.model_account_full_reconcile,group_kufula_user,1,1,1,0
access_donation_extension_wizard,donation.extension.wizard.access,model_donation_extension_wizard,base.group_user,1,1,1,1
access_donation_extension_history,donation.extension.history.access,model_donation_extension_history,odex_takaful.group_kufula_user,1,1,1,0
access_donation_extension_wizard_line,donation.extension.wizard.line.access,model_donation_extension_wizard_line,odex_takaful.group_kufula_user,1,1,1,0
access_donation_replacement_log,donation.replacement.log.access,model_donation_replacement_log,odex_takaful.group_kufula_user,1,1,1,0
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,odex_takaful.group_replace_sponsor,1,1,1,1
access_add_benefit_wizard,add.benefit.wizard.access,model_add_benefit_wizard,odex_takaful.group_kufula_user,1,1,1,1
access_extension_payment_wizard_line,extension.payment.wizard.line.access,model_extension_payment_wizard_line,odex_takaful.group_kufula_user,1,1,1,1
access_group_kufula_user_product_template,access_group_kufula_user_product_template,product.model_product_template,odex_takaful.group_kufula_user,1,1,0,0
access_group_kufula_user_account_move,access_group_kufula_user_account_move,account.model_account_move,odex_takaful.group_kufula_user,1,1,1,0
access_group_kufula_user_sale_order,access_group_kufula_user_sale_order,sale.model_sale_order,odex_takaful.group_kufula_user,1,1,1,0
access_group_kufula_user_grant_benefit,access_group_kufula_user_grant_benefit,odex_benefit.model_grant_benefit,odex_takaful.group_kufula_user,1,1,1,0
access_group_kufula_user_res_partner,access_group_kufula_user_res_partner,base.model_res_partner,odex_takaful.group_kufula_user,1,1,1,0
access_replace_benefit_wizard,replace.benefit.wizard.access,model_replace_benefit_wizard,odex_takaful.group_kufula_user,1,1,1,1
access_donation_extension_history,donation.extension.history.access,model_donation_extension_history,group_kufula_user,1,1,1,0
access_donation_extension_wizard_line,donation.extension.wizard.line.access,model_donation_extension_wizard_line,group_kufula_user,1,1,1,0
access_donation_replacement_log,donation.replacement.log.access,model_donation_replacement_log,group_kufula_user,1,1,1,0
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,group_replace_sponsor,1,1,1,1
access_add_benefit_wizard,add.benefit.wizard.access,model_add_benefit_wizard,group_kufula_user,1,1,1,1
access_extension_payment_wizard_line,extension.payment.wizard.line.access,model_extension_payment_wizard_line,group_kufula_user,1,1,1,1
access_group_kufula_user_product_template,access_group_kufula_user_product_template,product.model_product_template,group_kufula_user,1,1,0,0
access_group_kufula_user_account_move,access_group_kufula_user_account_move,account.model_account_move,group_kufula_user,1,1,1,0
access_group_kufula_user_sale_order,access_group_kufula_user_sale_order,sale.model_sale_order,group_kufula_user,1,1,1,0
access_group_kufula_user_grant_benefit,access_group_kufula_user_grant_benefit,odex_benefit.model_grant_benefit,group_kufula_user,1,1,1,0
access_group_kufula_user_res_partner,access_group_kufula_user_res_partner,base.model_res_partner,group_kufula_user,1,1,1,0
access_replace_benefit_wizard,replace.benefit.wizard.access,model_replace_benefit_wizard,group_kufula_user,1,1,1,1
access_group_esterdad_wizard,access_group_esterdad_wizard,model_esterdad_wizard,,1,1,1,0
access_group_otp_confirmation_wizard,access_group_otp_confirmation_wizard,model_otp_confirmation_wizard,,1,1,1,0
access_payment_machine,access_payment_machine,model_payment_machine,odex_takaful.group_kufula_user,1,1,1,1
access_payment_machine_manager,access_payment_machine_manager,model_payment_machine,odex_takaful.sponsorship_system_manager_group,1,1,1,1
access_payment_machine,access_payment_machine,model_payment_machine,group_kufula_user,1,1,1,1
access_payment_machine_manager,access_payment_machine_manager,model_payment_machine,sponsorship_system_manager_group,1,1,1,1
access_global_extension_wizard,access_global_extension_wizard,model_global_extension_wizard,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sponsorship_payment_user Full access on sponsorship.payment to Payment User Full access on sponsorship.payment model_sponsorship_payment group_kufula_user 1 1 1 1
3 access_month_payment_full Full access on month.payment to Month Payment Manager Full access on month.payment model_month_payment odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
4 access_takaful_message_template Full access on takaful.message.template model_takaful_message_template odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
5 access_sponsorship_cancellation Full access on sponsorship.cancellation model_sponsorship_cancellation odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
6 access_takaful_contribution Full access on takaful.contribution model_takaful_contribution odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
7 access_takaful_push_notification Full access on takaful.push.notification model_takaful_push_notification odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
8 access_month_payment_line Full access on month.payment.line model_month_payment_line odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
9 access_sponsorship_benefit_arrears Full access on sponsorship.benefit.arrears model_sponsorship_benefit_arrears odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
10 access_sponsorship_reason_stop Full access on sponsorship.reason.stop model_sponsorship_reason_stop odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
11 access_donate_for_another_person access_donate_for_another_person model_donate_for_another_person odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
12 access_donations_items access_donations_items model_donations_items odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
13 access_replacement_reasons access_replacement_reasons model_replacement_reasons odex_takaful.group_orphan_replacement group_orphan_replacement 1 1 1 1
14 access_replacement_process access_replacement_process model_replacement_process odex_takaful.group_orphan_replacement group_orphan_replacement 1 1 1 0
15 access_takaful_notification access_takaful_notification model_takaful_notification 1 1 1 1
16 access_sponsorship_states access_sponsorship_states model_sponsorship_states 1 1 1 1
access_replacement_wiz access_replacement_wiz model_replacement_wiz 1 1 1 1
access_donations_details_lines access_donations_details_lines model_donations_details_lines odex_takaful.group_kufula_user 1 1 1 1
17 access_refund_details_lines access_replacement_wiz access_refund_details_lines access_replacement_wiz model_refund_details_lines model_replacement_wiz odex_takaful.group_kufula_user 1 1 1 1
18 access_points_of_sale_custom access_donations_details_lines access_points_of_sale_custom access_donations_details_lines model_points_of_sale_custom model_donations_details_lines odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
19 access_payment_details_lines access_refund_details_lines access_payment_details_lines access_refund_details_lines model_payment_details_lines model_refund_details_lines odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
20 access_sponsorship_scheduling_line access_points_of_sale_custom access_sponsorship_scheduling_line access_points_of_sale_custom model_sponsorship_scheduling_line model_points_of_sale_custom odex_takaful.group_kufula_user group_kufula_user 1 0 1 0 1 0 1
21 access_refund_reasons access_payment_details_lines access_refund_reasons access_payment_details_lines model_refund_reasons model_payment_details_lines odex_takaful.group_kufula_user group_kufula_user 1 1 1 1
22 access_takaful_sponsorship_user access_sponsorship_scheduling_line Full access on takaful.sponsorship to Sponsorship User access_sponsorship_scheduling_line model_takaful_sponsorship model_sponsorship_scheduling_line group_kufula_user 1 1 0 1 0 1 0
23 access_res_partner_user access_refund_reasons Access on res.pfartner to Sponsorship User access_refund_reasons base.model_res_partner model_refund_reasons group_kufula_user 1 1 0 1 0 1
24 access_res_users_user access_takaful_sponsorship_user Access on res.users to Sponsorship User Full access on takaful.sponsorship base.model_res_users model_takaful_sponsorship group_kufula_user 1 1 0 1 0 1
25 access_grant_benefit_invoice access_res_partner_user Full access on grant.benefit.invoice to Month Payment Manager Access on res.partner model_grant_benefit_invoice base.model_res_partner base.group_user group_kufula_user 1 1 1 0 1 0
26 access_refund_wiz access_res_users_user access_refund_wiz Access on res.users model_refund_wiz base.model_res_users group_kufula_user 1 1 1 0 1 0
27 access_add_details_wiz access_grant_benefit_invoice access_add_details_wiz Full access on grant.benefit.invoice model_add_details_wiz model_grant_benefit_invoice base.group_user 1 1 1 1
28 access_preferred_communication access_refund_wiz access_preferred_communication access_refund_wiz model_preferred_communication model_refund_wiz 1 1 1 1
29 access_takaful_payment_method access_add_details_wiz access_takaful_payment_method access_add_details_wiz model_takaful_payment_method model_add_details_wiz 1 1 1 1
30 access_replacement_line_method access_preferred_communication access_takaful_replacement_line access_preferred_communication model_replacement_line model_preferred_communication 1 1 1 1
31 access_replacement_process_line_method access_takaful_payment_method access_takaful_replacement_process_line access_takaful_payment_method model_replacement_process_line model_takaful_payment_method 1 1 1 1
32 access_transfer_deduction_wizard access_replacement_line_method transfer.deduction.wizard.access access_takaful_replacement_line model_transfer_deduction_wizard model_replacement_line base.group_user 1 1 1 1
33 access_account_payment_register_donation_officer access_replacement_process_line_method account_payment_register_donation_officer access_takaful_replacement_process_line account.model_account_payment_register model_replacement_process_line odex_takaful.donation_officer_group 1 1 1 0 1
access_product_template_donation_officer product_template_donation_officer product.model_product_template odex_takaful.donation_officer_group 1 1 1 0
access_product_product_donation_officer product_product_donation_officer product.model_product_product odex_takaful.donation_officer_group 1 1 1 0
34 access_group_kufula_user_account_payment access_transfer_deduction_wizard access_group_kufula_user_account_payment transfer.deduction.wizard.access account.model_account_payment model_transfer_deduction_wizard odex_takaful.group_kufula_user base.group_user 1 1 1 0 1
35 access_group_kufula_user_account_partial_reconcile access_account_payment_register_donation_officer access_group_kufula_user_account_partial_reconcile account_payment_register_donation_officer account.model_account_partial_reconcile account.model_account_payment_register odex_takaful.group_kufula_user donation_officer_group 1 1 1 0
36 access_group_kufula_user_account_full_reconcile access_product_template_donation_officer access_group_kufula_user_account_full_reconcile product_template_donation_officer account.model_account_full_reconcile product.model_product_template odex_takaful.group_kufula_user donation_officer_group 1 1 1 0
37 access_donation_extension_wizard access_product_product_donation_officer donation.extension.wizard.access product_product_donation_officer model_donation_extension_wizard product.model_product_product base.group_user donation_officer_group 1 1 1 1 0
38 access_donation_extension_history access_group_kufula_user_account_payment donation.extension.history.access access_group_kufula_user_account_payment model_donation_extension_history account.model_account_payment odex_takaful.group_kufula_user group_kufula_user 1 1 1 0
39 access_donation_extension_wizard_line access_group_kufula_user_account_partial_reconcile donation.extension.wizard.line.access access_group_kufula_user_account_partial_reconcile model_donation_extension_wizard_line account.model_account_partial_reconcile odex_takaful.group_kufula_user group_kufula_user 1 1 1 0
40 access_donation_replacement_log access_group_kufula_user_account_full_reconcile donation.replacement.log.access access_group_kufula_user_account_full_reconcile model_donation_replacement_log account.model_account_full_reconcile odex_takaful.group_kufula_user group_kufula_user 1 1 1 0
access_replace_sponsor_wizard replace.sponsor.wizard.access model_replace_sponsor_wizard odex_takaful.group_replace_sponsor 1 1 1 1
41 access_add_benefit_wizard access_donation_extension_wizard add.benefit.wizard.access donation.extension.wizard.access model_add_benefit_wizard model_donation_extension_wizard odex_takaful.group_kufula_user base.group_user 1 1 1 1
42 access_extension_payment_wizard_line access_donation_extension_history extension.payment.wizard.line.access donation.extension.history.access model_extension_payment_wizard_line model_donation_extension_history odex_takaful.group_kufula_user group_kufula_user 1 1 1 1 0
43 access_group_kufula_user_product_template access_donation_extension_wizard_line access_group_kufula_user_product_template donation.extension.wizard.line.access product.model_product_template model_donation_extension_wizard_line odex_takaful.group_kufula_user group_kufula_user 1 1 0 1 0
44 access_group_kufula_user_account_move access_donation_replacement_log access_group_kufula_user_account_move donation.replacement.log.access account.model_account_move model_donation_replacement_log odex_takaful.group_kufula_user group_kufula_user 1 1 1 0
45 access_group_kufula_user_sale_order access_replace_sponsor_wizard access_group_kufula_user_sale_order replace.sponsor.wizard.access sale.model_sale_order model_replace_sponsor_wizard odex_takaful.group_kufula_user group_replace_sponsor 1 1 1 0 1
46 access_group_kufula_user_grant_benefit access_add_benefit_wizard access_group_kufula_user_grant_benefit add.benefit.wizard.access odex_benefit.model_grant_benefit model_add_benefit_wizard odex_takaful.group_kufula_user group_kufula_user 1 1 1 0 1
47 access_group_kufula_user_res_partner access_extension_payment_wizard_line access_group_kufula_user_res_partner extension.payment.wizard.line.access base.model_res_partner model_extension_payment_wizard_line odex_takaful.group_kufula_user group_kufula_user 1 1 1 0 1
48 access_replace_benefit_wizard access_group_kufula_user_product_template replace.benefit.wizard.access access_group_kufula_user_product_template model_replace_benefit_wizard product.model_product_template odex_takaful.group_kufula_user group_kufula_user 1 1 1 0 1 0
49 access_group_esterdad_wizard access_group_kufula_user_account_move access_group_esterdad_wizard access_group_kufula_user_account_move model_esterdad_wizard account.model_account_move group_kufula_user 1 1 1 0
50 access_group_otp_confirmation_wizard access_group_kufula_user_sale_order access_group_otp_confirmation_wizard access_group_kufula_user_sale_order model_otp_confirmation_wizard sale.model_sale_order group_kufula_user 1 1 1 0
51 access_payment_machine access_group_kufula_user_grant_benefit access_payment_machine access_group_kufula_user_grant_benefit model_payment_machine odex_benefit.model_grant_benefit odex_takaful.group_kufula_user group_kufula_user 1 1 1 1 0
52 access_payment_machine_manager access_group_kufula_user_res_partner access_payment_machine_manager access_group_kufula_user_res_partner model_payment_machine base.model_res_partner odex_takaful.sponsorship_system_manager_group group_kufula_user 1 1 1 1 0
53 access_replace_benefit_wizard replace.benefit.wizard.access model_replace_benefit_wizard group_kufula_user 1 1 1 1
54 access_group_esterdad_wizard access_group_esterdad_wizard model_esterdad_wizard 1 1 1 0
55 access_group_otp_confirmation_wizard access_group_otp_confirmation_wizard model_otp_confirmation_wizard 1 1 1 0
56 access_payment_machine access_payment_machine model_payment_machine group_kufula_user 1 1 1 1
57 access_payment_machine_manager access_payment_machine_manager model_payment_machine sponsorship_system_manager_group 1 1 1 1
58 access_global_extension_wizard access_global_extension_wizard model_global_extension_wizard 1 1 1 1

View File

@ -3,142 +3,53 @@
<record id="module_category_kufula" model="ir.module.category">
<field name="name">Kufula System</field>
<field name="description">Helps you manage Kafleen and Kafalat in kufula System</field>
<field name="description">Helps you manage Kafleen and Kafalat in Kufula System</field>
<field name="sequence">3</field>
</record>
<!-- <record id="group_kufula_viewer" model="res.groups">
<field name="name">Viewer</field>
<record id="group_kufula_user" model="res.groups">
<field name="name">Kufula User</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="group_kufula_officer" model="res.groups">
<field name="name">Officer</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_viewer'))]"/>
<field name="users" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="group_kufula_manager" model="res.groups">
<field name="name">Administrator</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_officer'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record> -->
<record id="group_can_make_sponsorship_payment" model="res.groups">
<field name="name">Make Sponsorship Payments</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can Make Payments For Sponsorships?</field>
</record>
<record id="group_can_recieve_sponsorship_payment" model="res.groups">
<field name="name">Recieve Sponsorship Payments</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can Recieve Payments For Sponsorships?</field>
</record>
<record id="takaful_group_user_sponsor" model="res.groups">
<field name="name">Sponsor Account</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Is this user a Sponsor?</field>
</record>
<record id="group_can_activate_sponsor" model="res.groups">
<field name="name">Can Activate Inactive Sponsors</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can make Sponsor active again?</field>
</record>
<record id="group_refund_approval" model="res.groups">
<field name="name">Refund Approval</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can make Approval for refund?</field>
</record>
<record id="group_orphan_replacement" model="res.groups">
<field name="name">Orphan Replacement</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Orphan Replacement</field>
</record>
<record id="group_replace_sponsor" model="res.groups">
<field name="name">Replace Sponsor</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can Replace Sponsor on Donation Lines</field>
</record>
<record id="group_show_donation_item_product" model="res.groups">
<field name="name">Show Donation Item Product</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="comment">Can Show Donation Item Product?</field>
</record>
<!-- <record id="group_donations_coordinator" model="res.groups">
<field name="name">Donations Coordinator</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="group_sponsorship_coordinator" model="res.groups">
<field name="name">Sponsorship Coordinator</field>
<field name="category_id" ref="module_category_kufula"/>
</record> -->
<!-- <record id="group_branch_manager" model="res.groups">
<field name="name">Branch Manager</field>
<field name="category_id" ref="module_category_kufula"/>
</record> -->
<!-- <record id="group_sponsorship_system_manager" model="res.groups">
<field name="name">Sponsorship System Manager</field>
<field name="category_id" ref="module_category_kufula"/>
</record> -->
<!-- <record id="donations_coordinator_rule" model="ir.rule">
<field name="name">Donations Coordinator - Record Type Donation</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_donations_coordinator'))]"/>
<field name="domain_force">[('record_type', '=', 'donation')]</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 id="sponsorship_coordinator_rule" model="ir.rule">
<field name="name">Sponsorship Coordinator - Record Type Sponsorship</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_sponsorship_coordinator'))]"/>
<field name="domain_force">[('record_type', '=', 'sponsorship')]</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 id="branch_manager_rule" model="ir.rule">
<field name="name">Branch Manager - Can Only See Their Branch</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_branch_manager'))]"/>
<field name="domain_force">[('manager_id.user_id', '=', user.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 id="sponsorship_system_manager_rule" model="ir.rule">
<field name="name">Sponsorship System Manager</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_sponsorship_system_manager'))]"/>
<field name="domain_force">[(1,'=',1)]</field>
</record> -->
<record id="group_kufula_user" model="res.groups">
<field name="name">Kufula User</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="group_print_receipt" model="res.groups">
@ -146,13 +57,48 @@
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="group_update_sensible_fields" model="res.groups">
<field name="name">Updating Months Count &amp; Start Date</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="donation_officer_group" model="res.groups">
<field name="name">Donations Officer</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
<field name="implied_ids" eval="[(6, 0, [ref('group_kufula_user')])]"/>
</record>
<record id="sponsorship_officer_group" model="res.groups">
<field name="name">Sponsorships Officer</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(6, 0, [ref('group_kufula_user')])]"/>
</record>
<record id="branch_manager_group" model="res.groups">
<field name="name">Branch Manager</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(6, 0, [ref('group_kufula_user'), ref('sponsorship_officer_group'), ref('donation_officer_group')])]"/>
</record>
<record id="sponsorship_system_manager_group" model="res.groups">
<field name="name">Sponsorship System Manager</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(6, 0, [ref('branch_manager_group')])]"/>
</record>
<record id="sponsorship_restrict_orphan_group" model="res.groups">
<field name="name">Sponsorship General Restriction</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(6, 0, [ref('group_kufula_user')])]"/>
</record>
<record id="group_sponsor_department_access" model="res.groups">
<field name="name">Sponsor - Department Access</field>
<field name="category_id" ref="module_category_kufula"/>
</record>
<record id="donation_officer_restrictions" model="ir.rule">
<field name="name">Donations Officer can only see his donations or his branch sponsors</field>
<field name="name">Donations Officer: Own Donations</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('donation_officer_group'))]"/>
<field name="domain_force">[
@ -160,19 +106,24 @@
('create_uid', '=', user.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 id="sponsorship_officer_group" model="res.groups">
<field name="name">Sponsorships Officer</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
<record id="donation_officer_donations_details_restrictions" model="ir.rule">
<field name="name">Donations Officer: Own Donation Lines</field>
<field name="model_id" ref="model_donations_details_lines"/>
<field name="groups" eval="[(4, ref('donation_officer_group'))]"/>
<field name="domain_force">[
'&amp;',
('record_type', 'in', [False, 'donation']),
'|',
('sponsorship_id.create_uid', '=', user.id),
('sponsorship_mechanism_id.create_uid', '=', user.id)
]
</field>
</record>
<record id="sponsorship_officer_restrictions" model="ir.rule">
<field name="name">Sponsorships Officer can only see his sponsorships or his branch sponsors</field>
<field name="name">Sponsorships Officer: Own Sponsorships</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('sponsorship_officer_group'))]"/>
<field name="domain_force">[
@ -180,143 +131,110 @@
('create_uid', '=', user.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 id="branch_manager_group" model="res.groups">
<field name="name">Branch Manager</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
<record id="sponsorship_officer_donations_details_restrictions" model="ir.rule">
<field name="name">Sponsorships Officer: Own Donation Lines</field>
<field name="model_id" ref="model_donations_details_lines"/>
<field name="groups" eval="[(4, ref('sponsorship_officer_group'))]"/>
<field name="domain_force">[
'&amp;',
('record_type', 'in', [False, 'sponsorship']),
'|',
('sponsorship_id.create_uid', '=', user.id),
('sponsorship_mechanism_id.create_uid', '=', user.id)
]
</field>
</record>
<record id="sponsorship_officer_donations_extensions_restrictions" model="ir.rule">
<field name="name">Sponsorships Officer: Own Donation Extensions</field>
<field name="model_id" ref="model_donation_extension_history"/>
<field name="groups" eval="[(4, ref('sponsorship_officer_group'))]"/>
<field name="domain_force">[
('create_uid', '=', user.id)
]</field>
</record>
<record id="branch_manager_restrictions" model="ir.rule">
<field name="name">Branch Manager can only see all his branch sponsorships and donations</field>
<field name="name">Branch Manager: All Branch Sponsorships</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
<field name="domain_force">[('branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False])]</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"/>
<field name="domain_force">[
'|',
('branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False]),
('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)
]</field>
</record>
<record id="sponsorship_system_manager_group" model="res.groups">
<field name="name">Sponsorship System Manager</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
</record>
<record id="sponsorship_restrict_orphan_group" model="res.groups">
<field name="name">Sponsorship General Restriction</field>
<field name="category_id" ref="module_category_kufula"/>
<field name="implied_ids" eval="[(4, ref('group_kufula_user'))]"/>
</record>
<record id="responsible_user_sponsorship_access" model="ir.rule">
<field name="name">Responsible Users can access related Sponsorships</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_kufula_user'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', 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 id="kufula_user_donations_details_lines_access" model="ir.rule">
<field name="name">Users can access related Donations Details Lines</field>
<record id="branch_manager_donations_details_access" model="ir.rule">
<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('group_kufula_user'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', 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"/>
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
<field name="domain_force">[
'|', '|', '|',
('sponsorship_id.branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False]),
('sponsorship_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id),
('sponsorship_mechanism_id.branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False]),
('sponsorship_mechanism_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)
]</field>
</record>
<record id="sponsorship_system_manager_restrictions" model="ir.rule">
<field name="name">Sponsorship System Manager can see everything and settings</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('sponsorship_system_manager_group'))]"/>
<field name="domain_force">[(1, '=', 1)]</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 id="branch_manager_donation_extensions_access" model="ir.rule">
<field name="name">Branch Manager: All Branch Donation Extensions</field>
<field name="model_id" ref="model_donation_extension_history"/>
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
<field name="domain_force">[
'|', '|', '|', '|',
('create_uid', '=', user.id),
('create_uid.employee_id.department_id.manager_id.user_id', 'in', [user.id, False]),
('create_uid.employee_id.department_id', 'child_of', user.employee_id.department_id.id),
('sponsorship_id.branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False]),
('sponsorship_id.branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)
]</field>
</record>
<!-- Groups for Department-based Access Control -->
<!-- <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 id="group_sponsor_department_access" model="res.groups">
<field name="name">Sponsor - Department Access</field>
<field name="category_id" ref="module_category_kufula"/>
<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">
<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', '=', 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 id="family_member_department_rule" model="ir.rule">
<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', '=', 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 id="sponsor_department_rule" model="ir.rule">
<field name="name">Sponsor - Department Based Access</field>
<field name="model_id" ref="odex_takaful.model_takaful_sponsor"/>
<field name="groups" eval="[(4, ref('group_sponsor_department_access'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', 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"/>
<field name="groups" eval="[(4, ref('group_sponsor_department_access')), (4, ref('branch_manager_group'))]"/>
<field name="domain_force">[('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]</field>
</record>
<record id="sponsorship_system_manager_restrictions" model="ir.rule">
<field name="name">Sponsorship System Manager: See All Sponsorships</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('sponsorship_system_manager_group'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<record id="sponsorship_system_manager_donations_restrictions" model="ir.rule">
<field name="name">Sponsorship System Manager: See All Donations Lines</field>
<field name="model_id" ref="model_donations_details_lines"/>
<field name="groups" eval="[(4, ref('sponsorship_system_manager_group'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
<record id="sponsorship_marketer_restrictions" model="ir.rule">
<!-- <field name="name">Sponsorship Marketer can see and select all employees</field>-->
<field name="name">Sponsorship Marketer can see his employees</field>
<field name="name">Sponsorship Marketer: See Own/Dept Employees</field>
<field name="model_id" ref="hr.model_hr_employee"/>
<field name="groups" eval="[(4, ref('donation_officer_group'))]"/>
<!-- <field name="domain_force">[(1, '=', 1)]</field>-->
<field name="domain_force">['|', '|', ('user_id','=',user.id), ('department_id.manager_id.user_id','=',
user.id), ('parent_id.user_id','=', user.id)]
</field>
<field name="domain_force">['|', '|', ('user_id','=',user.id), ('department_id.manager_id.user_id','=', user.id), ('parent_id.user_id','=', user.id)]</field>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="0"/>
<field name="perm_unlink" eval="0"/>
</record>
<record id="group_update_sensible_fields" model="res.groups">
<field name="name">Updating Months Count &amp; Start Date</field>
<field name="category_id" ref="module_category_kufula"/>
<record id="sponsorship_system_manager_donation_extensions_restrictions" model="ir.rule">
<field name="name">Sponsorship System Manager: See All Donations Extensions</field>
<field name="model_id" ref="model_donation_extension_history"/>
<field name="groups" eval="[(4, ref('sponsorship_system_manager_group'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
</data>
</odoo>
</data>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -5,6 +5,13 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="after">
<div class="alert alert-danger" role="alert"
style="margin-bottom:0px;text-align:center;"
attrs="{'invisible':[('esterdad_id', '=', False)]}">
<field name="sponsorship_cancel_reason"/>
</div>
</xpath>
<xpath expr="//field[@name='invoice_origin']" position="attributes">
<attribute name="attrs">{'invisible': False}</attribute>
@ -14,7 +21,11 @@
</xpath>
<xpath expr="//notebook" position="inside">
<page string="Previous Payments" attrs="{'invisible': [('esterdad_id', '=', False)]}">
<field name="previous_payment_ids" widget="many2many" />
</page>
</xpath>
</field>

View File

@ -4,6 +4,7 @@
<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"/>
<link rel="stylesheet" type="text/scss" href="/odex_takaful/static/src/scss/orphan-fonts.scss"/>
</xpath>
</template>

View File

@ -30,14 +30,15 @@
<form create="0" edit="0" delete="0">
<header>
<field name="state" widget="statusbar" statusbar_visible="active,paid,cancel" />
<button string="Pay" name="action_pay_invoice" type="object" class="oe_highlight" states="active"/>
<button string="Pay" name="action_pay_invoice" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('state', '!=', 'active'), ('new_direct_debit', '=', True)]}"/>
<button string="Cancel" name="action_cancel_invoice" type="object" states="active"/>
<button
name="action_print_extension_receipt"
type="object"
string="Print Extension Receipt"
class="btn-primary"
icon="fa-print"
attrs="{'invisible': [('state', '!=', 'paid')]}"
attrs="{'invisible': [('state', 'not in', ['wait_pay', 'paid'])]}"
groups="odex_takaful.group_print_receipt"
/>
</header>
@ -80,6 +81,10 @@
<field name="name">Extension History</field>
<field name="res_model">donation.extension.history</field>
<field name="view_mode">tree,form</field>
<field name="context">{
'wizard_force_show_all': True,
'active_test': False
}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No extension history found

View File

@ -275,21 +275,21 @@
attrs="{'invisible': [('sponsorship_duration','!=','temporary')], 'required': [('sponsorship_duration','=','temporary')], 'readonly': [('parent_state', '!=', 'draft')]}"
readonly="1" force_save="1" />
<field name="payment_month_count" groups="!odex_takaful.group_update_sensible_fields" attrs="{
'invisible': ['&amp;', ('sponsorship_duration','!=','temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration','=','temporary')],
'invisible': ['&amp;', ('sponsorship_duration','!=','temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration','=','temporary')],
'readonly': [('parent_state', '!=', 'draft')]
}" />
<field name="payment_month_count" groups="odex_takaful.group_update_sensible_fields" attrs="{
'invisible': ['&amp;', ('sponsorship_duration','!=','temporary'), ('direct_debit', '=', False)],
'invisible': ['&amp;', ('sponsorship_duration','!=','temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration','=','temporary')]
}" />
<field name="start_date" string="Start Date" widget="date" groups="!odex_takaful.group_update_sensible_fields" attrs="{
'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration', '=','temporary')],
'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration', '=','temporary')],
'readonly': [('parent_state', '!=', 'draft')]
}" />
<field name="start_date" string="Start Date" widget="date" groups="odex_takaful.group_update_sensible_fields" context="{'update_start_date': True}" attrs="{
'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)],
'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)],
'required': [('sponsorship_duration', '=','temporary')]
}" />
<field name="end_date" string="End Date" widget="date"
@ -407,7 +407,7 @@
<field name="active" eval="False" />
<field name="inherit_id" ref="odex_takaful.donations_details_lines_view_form"/>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="edit">1</attribute>
</xpath>
@ -415,25 +415,6 @@
</field>
</record>
<record id="manager_donations_details_lines_sponsorship_action" model="ir.actions.act_window">
<field name="name">Sponsorship Items</field>
<field name="res_model">donations.details.lines</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('record_type', '=', 'sponsorship')]</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('donations_details_lines_sponsorship_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('donations_details_lines_view_form_odex_takaful')})]"/>
<field name="search_view_id" ref="donations_details_lines_sponsorship_search"/>
<field name="context">{'create': False, 'delete': False, 'default_record_type': 'sponsorship'}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No sponsorship items found
</p>
<p>
Sponsorship items appear here After confirming sponsorships from the sponsorships screen main
</p>
</field>
</record>
<record id="donations_details_lines_view_tree_waiting" model="ir.ui.view">
<field name="name">donations.details.lines.view.tree.waiting</field>
@ -522,7 +503,7 @@
<!-- ========================================== -->
<!-- بنود الكفالات - Sponsorship Lines Views -->
<!-- ========================================== -->
<!-- Tree View for Sponsorship Lines -->
<record id="donations_details_lines_sponsorship_tree" model="ir.ui.view">
<field name="name">donations.details.lines.sponsorship.tree</field>
@ -536,7 +517,7 @@
<field name="benefit_id"/>
<field name="family_id" optional="hide"/>
<field name="age" string="Age"/>
<field name="age_category" widget="badge"
<field name="age_category" widget="badge"
decoration-info="age_category == 'all'"
decoration-warning="age_category == '16'"
decoration-danger="age_category == '18'" optional="hide"/>
@ -650,10 +631,31 @@
</field>
</record>
<record id="manager_donations_details_lines_sponsorship_action" model="ir.actions.act_window">
<field name="name">Sponsorship Items</field>
<field name="res_model">donations.details.lines</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('record_type', '=', 'sponsorship')]</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('donations_details_lines_sponsorship_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('donations_details_lines_view_form_odex_takaful')})]"/>
<field name="search_view_id" ref="donations_details_lines_sponsorship_search"/>
<field name="context">{'create': False, 'delete': False, 'default_record_type': 'sponsorship'}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No sponsorship items found
</p>
<p>
Sponsorship items appear here After confirming sponsorships from the sponsorships screen main
</p>
</field>
</record>
<!-- ========================================== -->
<!-- التبرعات غير المشروطة - Unconditional -->
<!-- ========================================== -->
<!-- Tree View for Unconditional Donations -->
<record id="donations_unconditional_tree" model="ir.ui.view">
<field name="name">donations.details.lines.unconditional.tree</field>
@ -726,7 +728,7 @@
<field name="name">Unconditional Donations</field>
<field name="res_model">donations.details.lines</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('donation_mechanism', '=', 'without_conditions')]</field>
<field name="domain">[('record_type', '=', 'donation'), ('donation_mechanism', '=', 'without_conditions')]</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('donations_unconditional_tree')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('donations_details_lines_view_form')})]"/>
@ -745,7 +747,7 @@
<!-- ========================================== -->
<!-- التبرعات المشروطة - Conditional (For Families) -->
<!-- ========================================== -->
<!-- Tree View for Conditional Donations -->
<record id="donations_conditional_tree" model="ir.ui.view">
<field name="name">donations.details.lines.conditional.tree</field>
@ -830,4 +832,4 @@
</field>
</record>
</odoo>
</odoo>

View File

@ -112,6 +112,8 @@
<field name="name">family.member.tree.inherit</field>
<field name="model">family.member</field>
<field name="inherit_id" ref="odex_benefit.family_member_tree"/>
<field name="mode">primary</field>
<field name="active">False</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='member_status']" position="after">
<field name="kafala_status" widget="badge"

View File

@ -19,7 +19,8 @@
<!-- Sponsorship Lines -->
<menuitem id="donations_details_lines_app_menu" parent="sponsorship_lines_menu"
name="Sponsorship Lines" action="donations_details_lines_sponsorship_action" sequence="1"/>
name="Sponsorship Lines" action="donations_details_lines_sponsorship_action"
groups="odex_takaful.sponsorship_officer_group" sequence="1"/>
<menuitem id="manager_donations_details_lines_app_menu" parent="sponsorship_lines_menu"
name="Editable Sponsorship Lines" action="manager_donations_details_lines_sponsorship_action"
groups="odex_takaful.group_update_sensible_fields" sequence="1"/>
@ -38,11 +39,23 @@
<menuitem id="donations_details_lines_waiting_app_menu" parent="menu_replacement_root"
name="Waiting for Beneficiary" action="donations_details_lines_waiting_action" sequence="2"/>
<menuitem id="menu_global_extension_wizard"
name="Global Extension"
parent="menu_replacement_root"
action="action_global_extension_wizard"
sequence="3"/>
<menuitem id="menu_donation_extension_history"
name="Donation Extension History"
parent="menu_replacement_root"
action="action_donation_extension_history"
sequence="4"/>
<!-- ========================================== -->
<!-- التبرعات - Donations Menu -->
<!-- ========================================== -->
<menuitem id="donations_main_menu" parent="takaful_kufula_app_top_menu"
sequence="20" name="Donations" groups="odex_takaful.group_kufula_user"/>
sequence="20" name="Donations" groups="odex_takaful.donation_officer_group"/>
<menuitem id="donations_unconditional_menu" parent="donations_main_menu"
name="Unconditional Donations" action="donations_unconditional_action" sequence="1"/>

View File

@ -193,7 +193,7 @@
]
}"/>
<div class="o_row">
<field name="sponsor_id" nolabel="1"
<field name="sponsor_id" nolabel="1"
context="{'form_view_ref': 'odex_takaful.view_takaful_sponsor_form' ,'tree_view_ref':'odex_takaful.takaful_sponsor_tree'}"
attrs="{
'invisible': ['|',
@ -228,16 +228,11 @@
],
'readonly': [('state','!=','draft')]
}"/>
<field name="sponsor_phone" string="Mobile Number" widget="phone"
<field name="sponsor_phone" string="Mobile Number" widget="phone" placeholder="05xxxxxxxx" force_save="1"
attrs="{
'invisible': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','!=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','!=','unknown')
],
'readonly': [('state','!=','draft')]
}"
placeholder="05xxxxxxxx"/>
'required': [('sponsor_or_donor_type', '!=', 'unknown')],
'readonly': [('state', '!=', 'draft')]
}"/>
<field name="preferred_communication" string="Preferred Communication"
attrs="{
@ -346,10 +341,17 @@
<field name="name" widget="section_and_note_text" optional="show"/>
<field name="direct_debit"/>
<field name="sponsor_id" invisible="1"/>
<field name="show_last_digits" invisible="1"/>
<field name="direct_debit_partner_bank_id"
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': sponsor_id}"
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"
attrs="{'invisible': [('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', False)]}"
options="{'skip_disable_quick_create': True}"/>
<field name="last_digits"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}" placeholder="You Can Type 4 Digits"/>
<field name="bank_id"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}"/>
<field name="journal_id"
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
@ -599,10 +601,17 @@
<field name="donation_types"
invisible="1"/>
<field name="sponsor_id" invisible="1"/>
<field name="show_last_digits" invisible="1"/>
<field name="direct_debit_partner_bank_id"
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': sponsor_id}"
attrs="{'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"
attrs="{'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', False)]}"
options="{'skip_disable_quick_create': True}"/>
<field name="last_digits"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}" placeholder="You Can Type 4 Digits"/>
<field name="bank_id"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}"/>
<field name="journal_id"
attrs="{'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
@ -676,14 +685,15 @@
<page string="Orphans and Widows List"
attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('hide_beneficiary_group', '=', True)]}">
<!-- attrs="{'invisible': ['|', '|', '|', ('hide_beneficiary_group','=', True), ('parent.record_type','!=','sponsorship'), ('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'both')]}">-->
<field name="benefit_ids" nolabel="1" options="{'no_create': True}" context="{'group_by': 'benefit_group'}">
<tree editable="bottom">
<field name="benefit_group" invisible="1"/>
<field name="name"/>
<field name="age"/>
<field name="member_status"/>
</tree>
</field>
<field name="benefit_ids" nolabel="1" options="{'no_create': True}"
context="{'group_by': 'benefit_group', 'tree_view_ref': 'odex_takaful.view_family_member_tree_inherit'}">
<tree editable="bottom">
<field name="benefit_group" invisible="1"/>
<field name="name"/>
<field name="age"/>
<field name="member_status"/>
</tree>
</field>
</page>
<page string="Beneficiary Filters" autofocus="false"
invisible="1">
@ -857,6 +867,7 @@
domain="[('state', '=', 'replacement_done')]"/>
<filter string="Canceled" name="filter_canceled" domain="[('state', '=', 'canceled')]"/>
<filter string="Closed" name="filter_closed" domain="[('state', '=', 'closed')]"/>
<filter string="Sponsorship Creation Date" name="filter_sponsorship_creation_date" date="sponsorship_creation_date"/>
<separator/>
<!-- Record Type Filters -->
<filter string="Sponsorship" name="filter_sponsorship" domain="[('record_type', '=', 'sponsorship')]"/>
@ -878,7 +889,6 @@
</group>
<separator/>
<searchpanel>
<field name="state" enable_counters="1"/>
<field name="state" enable_counters="1"/>
<field name="record_type" enable_counters="1"/>
<field name="payment_method_display" icon="fa-credit-card" enable_counters="1"/>

View File

@ -33,6 +33,7 @@
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="Sponsors List" decoration-danger="active==False" sample="1">
<field name="code" optional="hide"/>
<field name="name" decoration-bf="1"/>
<field name="kafel_state" widget="badge" decoration-success="kafel_state == 'active'" decoration-danger="kafel_state == 'not_active'"/>
<field name="kafalat_count"/>
@ -57,6 +58,7 @@
<field name="mobile"/>
<field name="email"/>
<field name="id_number"/>
<field name="code"/>
<separator/>
<filter string="Active Sponsors" name="active_sponsors" domain="[('kafel_state', '=', 'active')]"/>
<filter string="Inactive Sponsors" name="inactive_sponsors" domain="[('kafel_state', '=', 'not_active')]"/>

View File

@ -12,3 +12,4 @@ from . import add_benefit_wizard
from . import replace_benefit_wizard
from . import account_payment_register
from . import esterdad
from . import global_extension_wizard

View File

@ -58,6 +58,8 @@ class AccountRegisterPayment(models.TransientModel):
sponsorship_id = self.env.context.get('default_takaful_sponsorship_id') or self.env.context.get('active_id')
if sponsorship_id:
sponsorship = self.env['takaful.sponsorship'].browse(sponsorship_id)
if self.env.context.get('wizard_force_show_all'):
sponsorship = sponsorship.sudo()
if sponsorship.exists() and sponsorship.branch_custom_id:
return self.env['payment.machine'].search([
('branch_custom_id', '=', sponsorship.branch_custom_id.id),
@ -109,7 +111,8 @@ class AccountRegisterPayment(models.TransientModel):
"""Override to always group payments for sponsorship - simpler UX"""
for wizard in self:
# Always group payments when in sponsorship context
if self.env.context.get('sponsorship_payment'):
# if self.env.context.get('sponsorship_payment'):
if self.env.context.get('sponsorship_payment') and self.show_payment_group:
wizard.group_payment = True
else:
# Fall back to default Odoo behavior
@ -139,6 +142,8 @@ class AccountRegisterPayment(models.TransientModel):
for rec in self:
if rec.takaful_payment_method_id and rec.takaful_payment_method_id.journal_id:
sponsorships = self.env['takaful.sponsorship'].browse(self.env.context.get('sponsorship_id'))
if self.env.context.get('wizard_force_show_all'):
sponsorships = sponsorships.sudo()
branch_ids = sponsorships.mapped('branch_custom_id.id')
rec.journal_id = rec.takaful_payment_method_id.journal_id.id
@ -192,8 +197,12 @@ class AccountRegisterPayment(models.TransientModel):
def _create_payments(self):
sponsorship_line_ids = self.env.context.get('sponsorship_line_ids')
sponsorship_lines = self.env['donations.details.lines'].browse(sponsorship_line_ids).filtered(
lambda r: r.display_type == False)
if self.env.context.get('wizard_force_show_all'):
sponsorship_lines = self.env['donations.details.lines'].sudo().browse(sponsorship_line_ids).filtered(
lambda r: r.display_type == False)
else:
sponsorship_lines = self.env['donations.details.lines'].browse(sponsorship_line_ids).filtered(
lambda r: r.display_type == False)
sponsorship = self.env['takaful.sponsorship'].browse(self.env.context.get('sponsorship_id'))
payments = super(AccountRegisterPayment, self)._create_payments()
if sponsorship_lines:
@ -377,7 +386,10 @@ class AccountRegisterPayment(models.TransientModel):
if self.env.context.get('from_extension_history') and donation_extension_history_id and res:
history = self.env['donation.extension.history'].browse(donation_extension_history_id)
if history:
history.sudo().write({'state': 'paid'})
history.paid_amount += self.amount
if history.paid_amount >= history.extension_amount:
history.sudo()._apply_extension_on_sponsorship()
history.sudo().write({'state': 'paid'})
elif self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'):
if self.amount < self.env.context.get('default_amount'):
@ -405,6 +417,7 @@ class AccountRegisterPayment(models.TransientModel):
('invoice_id', '=', line.extension_invoice_id.id)
], limit=1)
if history:
history.sudo()._apply_extension_on_sponsorship()
history.sudo().write({'state': 'paid'})
return {

View File

@ -13,8 +13,7 @@
<group string="Benefit Information">
<field name="benefit_id"
context="{'group_by': 'benefit_group', 'show_age_in_kafalat': True}"
options="{'no_create': True, 'no_create_edit':True,'no_open': True}"
domain="[('allowed_sponsorship', '=', True)]"/>
options="{'no_create': True, 'no_create_edit':True,'no_open': True}"/>
</group>
</group>

View File

@ -68,6 +68,8 @@ class DonationExtensionWizard(models.TransientModel):
def _compute_line_ids(self):
extension_line_ids = [(5,)]
donation_detail_ids = self.env['donations.details.lines'].browse(self.env.context.get('donation_detail_ids'))
if self.env.context.get('wizard_force_show_all'):
donation_detail_ids = donation_detail_ids.sudo()
for line in donation_detail_ids:
if line.record_type == 'donation' or line.sponsorship_duration == 'permanent':
raise ValidationError(_("Only donation with direct debit or sponsorship can be extended. Line: %s") % line.name)
@ -115,8 +117,11 @@ class DonationExtensionWizard(models.TransientModel):
donation_line_ids += result[1]
if invoice_ids:
line_ids = self.line_ids
if self.env.context.get('wizard_force_show_all'):
line_ids = line_ids.sudo()
# Get unique sponsorship IDs and take the first one (they should be same in normal use)
sponsorship_ids = list(set(self.line_ids.mapped('donation_line_id.sponsorship_mechanism_id.id')))
sponsorship_ids = list(set(line_ids.mapped('donation_line_id.sponsorship_mechanism_id.id')))
sponsorship_id = sponsorship_ids[0] if sponsorship_ids else False
return {
@ -129,13 +134,13 @@ class DonationExtensionWizard(models.TransientModel):
'default_amount': amount,
'sponsorship_payment_skip_compute_amount': True,
'dont_redirect_to_payments': True,
'sponsorship_line_ids': self.line_ids.donation_line_id.ids,
'sponsorship_line_ids': line_ids.donation_line_id.ids,
'sponsorship_payment': True,
'default_sponsorship_payment': True,
'wiz_id': self.id,
'sponsorship_id': sponsorship_id,
'default_takaful_sponsorship_id': sponsorship_id,
'force_sponsorship_line_partner_id': self.line_ids.mapped('partner_id')[:1].id,
'force_sponsorship_line_partner_id': line_ids.mapped('partner_id')[:1].id,
},
'target': 'new',
'type': 'ir.actions.act_window',
@ -297,7 +302,19 @@ class DonationExtensionWizardLine(models.TransientModel):
donation_mechanism = fields.Selection(related='donation_line_id.donation_mechanism')
months = fields.Integer(related='wizard_id.months')
partner_id = fields.Many2one(related='donation_line_id.sponsor_id')
show_last_digits = fields.Boolean(string="Use 4 Digits", )
last_digits = fields.Char(string="Last Digits", size=32)
bank_id = fields.Many2one('res.bank', string="Bank")
@api.onchange("direct_debit_partner_bank_id", "direct_debit")
def onchange_direct_debit_partner_bank_id(self):
for rec in self:
if rec.direct_debit_partner_bank_id:
rec.show_last_digits = False
else:
rec.show_last_digits = True
@api.depends('benefits_count', 'donation_amount', 'months', 'donation_qty', 'record_type', 'sponsorship_type')
def _compute_total_donation_amount(self):
for rec in self:
@ -332,94 +349,108 @@ class DonationExtensionWizardLine(models.TransientModel):
if not self.donation_line_id:
raise ValidationError(_("No donation detail line selected."))
donation_line_id = self.donation_line_id
if self.env.context.get('wizard_force_show_all'):
donation_line_id = self.donation_line_id.sudo()
if not self.extension_invoice_id:
# Update the donation detail line
self.old_end_date = self.current_end_date
self.old_payment_month_count = self.donation_line_id.payment_month_count
self.old_payment_month_count = donation_line_id.payment_month_count
new_end_date = self.current_end_date + relativedelta(months=self.months)
old_end_date = self.current_end_date
# Update end date
donation_line_new_vals = {
'end_date': new_end_date,
'payment_month_count': self.donation_line_id.payment_month_count + self.months,
}
if self.direct_debit:
donation_line_new_vals.update({
'direct_debit': self.direct_debit,
'direct_debit_partner_bank_id': self.direct_debit_partner_bank_id.id,
'journal_id': self.journal_id.id,
'debit_payment_file_attachment': self.debit_payment_file_attachment,
'debit_payment_attachment_file_name': self.debit_payment_attachment_file_name,
})
self.donation_line_id.write(donation_line_new_vals)
# donation_line_new_vals = {
# 'end_date': new_end_date,
# 'payment_month_count': donation_line_id.payment_month_count + self.months,
# }
# if self.direct_debit:
# donation_line_new_vals.update({
# 'direct_debit': self.direct_debit,
# 'direct_debit_partner_bank_id': self.direct_debit_partner_bank_id.id,
# 'journal_id': self.journal_id.id,
# 'debit_payment_file_attachment': self.debit_payment_file_attachment,
# 'debit_payment_attachment_file_name': self.debit_payment_attachment_file_name,
# })
# donation_line_id.write(donation_line_new_vals)
benefit_ids = self.donation_line_id.benefit_ids | self.donation_line_id.benefit_id
benefit_ids.write({
'sponsorship_end_date': new_end_date,
'kafala_status': 'have_kafala',
})
# benefit_ids = donation_line_id.benefit_ids | donation_line_id.benefit_id
# benefit_ids.write({
# 'sponsorship_end_date': new_end_date,
# 'kafala_status': 'have_kafala',
# })
# Create new scheduling lines for the extension period
if self.direct_debit:
self._create_extension_scheduling_lines()
# # Create new scheduling lines for the extension period
# if self.direct_debit:
# self._create_extension_scheduling_lines()
# Create invoice for the extension
invoice_id = self._create_extension_invoice()
self.extension_invoice_id = invoice_id
# Create extension history record
self.env['donation.extension.history'].create({
'donation_detail_id': self.donation_line_id.id,
'sponsorship_id': self.donation_line_id.sponsorship_id.id or self.donation_line_id.sponsorship_mechanism_id.id,
history_id = self.env['donation.extension.history'].create({
'donation_detail_id': donation_line_id.id,
'sponsorship_id': donation_line_id.sponsorship_id.id or donation_line_id.sponsorship_mechanism_id.id,
'extension_amount': self.total_donation_amount,
'extension_months': self.months,
'old_end_date': old_end_date,
'new_end_date': new_end_date,
'invoice_id': invoice_id.id if invoice_id else False,
'old_direct_debit': self.donation_line_id.direct_debit,
'old_direct_debit': donation_line_id.direct_debit,
'new_direct_debit': self.direct_debit,
'direct_debit_partner_bank_id': self.direct_debit_partner_bank_id.id,
'debit_payment_file_attachment': self.debit_payment_file_attachment,
'debit_payment_attachment_file_name': self.debit_payment_attachment_file_name,
'journal_id': self.journal_id.id,
'last_digits': self.last_digits,
'bank_id': self.bank_id.id,
})
if self.direct_debit:
history_id.sudo()._apply_extension_on_sponsorship()
self.env['sponsorship.scheduling.line'].sudo().cron_process_scheduled_payments()
if not self.direct_debit:
return self.extension_invoice_id, self.donation_line_id
return self.extension_invoice_id, donation_line_id
return False
def _create_extension_scheduling_lines(self):
"""
Create scheduling lines for the extension period
"""
self.ensure_one()
# def _create_extension_scheduling_lines(self):
# """
# Create scheduling lines for the extension period
# """
# self.ensure_one()
donation_line = self.donation_line_id
start_date = self.current_end_date + relativedelta(months=1)
# donation_line = self.donation_line_id
# start_date = self.current_end_date + relativedelta(months=1)
# Distribute total amount across months
base_amount, remainder = divmod(self.total_donation_amount, self.months)
base_amount = float(base_amount)
# # Distribute total amount across months
# base_amount, remainder = divmod(self.total_donation_amount, self.months)
# base_amount = float(base_amount)
for month in range(self.months):
scheduled_date = start_date + relativedelta(months=month)
month_year = scheduled_date.strftime("%m/%Y")
# Distribute remainder across first months
amount = base_amount + 1 if month < remainder else base_amount
# Format the amount to 2 decimal places for better representation
amount = round(amount, 2)
# Create scheduling line
self.env['sponsorship.scheduling.line'].sudo().create({
'sponsorship_id': donation_line.sponsorship_id.id or donation_line.sponsorship_mechanism_id.id,
'donation_detail_linked_id': donation_line.id,
'beneficiary_id': donation_line.benefit_id.id if donation_line.benefit_id else False,
'month_year': month_year,
'scheduled_date': scheduled_date,
'amount': amount,
'status': 'unpaid',
})
# for month in range(self.months):
# scheduled_date = start_date + relativedelta(months=month)
# month_year = scheduled_date.strftime("%m/%Y")
# # Distribute remainder across first months
# amount = base_amount + 1 if month < remainder else base_amount
# # Format the amount to 2 decimal places for better representation
# amount = round(amount, 2)
# # Create scheduling line
# self.env['sponsorship.scheduling.line'].sudo().create({
# 'sponsorship_id': donation_line.sponsorship_id.id or donation_line.sponsorship_mechanism_id.id,
# 'donation_detail_linked_id': donation_line.id,
# 'beneficiary_id': donation_line.benefit_id.id if donation_line.benefit_id else False,
# 'month_year': month_year,
# 'scheduled_date': scheduled_date,
# 'amount': amount,
# 'status': 'unpaid',
# })
def _create_extension_invoice(self):
"""
@ -428,6 +459,8 @@ class DonationExtensionWizardLine(models.TransientModel):
self.ensure_one()
donation_line = self.donation_line_id
if self.env.context.get('wizard_force_show_all'):
donation_line = self.donation_line_id.sudo()
sponsorship = donation_line.sponsorship_id or donation_line.sponsorship_mechanism_id
# Get journal from settings
@ -475,32 +508,32 @@ class DonationExtensionWizardLine(models.TransientModel):
def cancel_extension(self):
self.ensure_one()
if self.extension_invoice_id:
invoice = self.extension_invoice_id
# if self.extension_invoice_id:
# invoice = self.extension_invoice_id
if invoice.state == 'posted':
invoice.button_draft()
invoice.button_cancel()
# if invoice.state == 'posted':
# invoice.button_draft()
# invoice.button_cancel()
else:
invoice.button_cancel()
# else:
# invoice.button_cancel()
scheduling_lines = self.env['sponsorship.scheduling.line'].search([
('donation_detail_linked_id', '=', self.donation_line_id.id),
('scheduled_date', '>', self.old_end_date)
])
scheduling_lines.sudo().unlink()
# scheduling_lines = self.env['sponsorship.scheduling.line'].search([
# ('donation_detail_linked_id', '=', self.donation_line_id.id),
# ('scheduled_date', '>', self.old_end_date)
# ])
# scheduling_lines.sudo().unlink()
self.donation_line_id.write({
'end_date': self.old_end_date,
'payment_month_count': self.old_payment_month_count,
})
# self.donation_line_id.write({
# 'end_date': self.old_end_date,
# 'payment_month_count': self.old_payment_month_count,
# })
history_records = self.env['donation.extension.history'].search([
('donation_detail_id', '=', self.donation_line_id.id),
('invoice_id', '=', self.extension_invoice_id.id if self.extension_invoice_id else False),
('new_end_date', '=', self.new_end_date),
])
history_records.sudo().unlink()
history_records.sudo().action_cancel_invoice()
return True

View File

@ -58,10 +58,17 @@
<field name="current_end_date" force_save="1"/>
<field name="new_end_date" force_save="1"/>
<field name="direct_debit" force_save="1"/>
<field name="show_last_digits" invisible="1"/>
<field name="direct_debit_partner_bank_id"
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': partner_id}"
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"
attrs="{'invisible': [('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', False)]}"
options="{'skip_disable_quick_create': True}"/>
<field name="last_digits"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}" placeholder="You Can Type 4 Digits"/>
<field name="bank_id"
attrs="{'invisible': ['|', ('show_last_digits', '=', False), ('direct_debit', '=', False)], 'required': ['&amp;', ('direct_debit', '=', True), ('show_last_digits', '=', True)]}"/>
<field name="journal_id" attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
<field name="debit_payment_file_attachment" widget="binary"
filename="debit_payment_attachment_file_name"

View File

@ -2,6 +2,8 @@
from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError, Warning
import logging
import random
import requests
from odoo import SUPERUSER_ID
from datetime import datetime, date, timedelta
@ -24,89 +26,130 @@ class EsterdadWizard(models.Model):
another_reason = fields.Boolean()
reason = fields.Text()
sponsor_id = fields.Many2one('takaful.sponsorship')
journal_entry_ids = fields.Many2many('account.move', domain="[('id', 'in', allowed_journal_entry_ids)]")
allowed_journal_entry_ids = fields.Many2many('account.move', compute='_compute_allowed_journal_entry_ids')
sponsor_name = fields.Char()
mobile = fields.Char()
mobile = fields.Char(required=True)
id_num = fields.Char()
payment_ids = fields.Many2many(
'account.payment',
'esterdad_wizard_payment_rel',
'wizard_id',
'payment_id',
string="Payments",
domain="[('id', 'in', allowed_payment_ids)]",
)
allowed_payment_ids = fields.Many2many(
'account.payment',
'esterdad_wizard_allowed_payment_rel',
'wizard_id',
'payment_id',
string="Allowed Payments",
)
payment_ids = fields.Many2many('account.payment', compute='_compute_payment_ids')
# allowed_payment_ids = fields.Many2many(
# 'account.payment',
# 'esterdad_wizard_allowed_payment_rel',
# 'wizard_id',
# 'payment_id',
# string="Allowed Payments",
# )
confirmed = fields.Boolean()
@api.onchange('sponsor_id')
def _onchange_sponsor_id_set_payment_domain(self):
"""Limit available payments to same partner within restriction_period days."""
@api.depends('sponsor_id')
def _compute_allowed_journal_entry_ids(self):
for rec in self:
domain = []
partner = False
invoice_names = []
refund_hour_limit = self.env['ir.config_parameter'].sudo().get_param('odex_takaful.cancel_refund', default=0)
limit_refund_date_time = fields.Datetime.now() - timedelta(hours=int(refund_hour_limit))
# rec.allowed_journal_entry_ids = rec.sponsor_id.journal_entry_ids.ids
rec.allowed_journal_entry_ids = rec.sponsor_id.journal_entry_ids.filtered(lambda r:
r.move_type == 'out_invoice' and\
r.payment_state == 'paid' and\
r.create_date >= limit_refund_date_time).ids
@api.depends('journal_entry_ids')
def _compute_payment_ids(self):
for rec in self:
rec.payment_ids = [(6, 0, rec.journal_entry_ids._get_reconciled_payments().ids)]
# @api.onchange('sponsor_id')
# def _onchange_sponsor_id_set_payment_domain(self):
# """Limit available payments to same partner within restriction_period days."""
# for rec in self:
# domain = []
# partner = False
# invoice_names = []
if rec.sponsor_id:
# Assuming sponsor_id.sponsor_id is the related partner on the sponsorship
partner = getattr(rec.sponsor_id, 'sponsor_id', False) or getattr(rec.sponsor_id, 'partner_id', False)
# if rec.sponsor_id:
# # Assuming sponsor_id.sponsor_id is the related partner on the sponsorship
# partner = getattr(rec.sponsor_id, 'sponsor_id', False) or getattr(rec.sponsor_id, 'partner_id', False)
# Get all invoices from journal_entry_ids where move_type is 'out_invoice'
invoices = rec.sponsor_id.journal_entry_ids.filtered(lambda inv: inv.move_type == 'out_invoice')
# Get all invoice names (numbers) in a list
invoice_names = invoices.mapped('name')
# # Get all invoices from journal_entry_ids where move_type is 'out_invoice'
# invoices = rec.sponsor_id.journal_entry_ids.filtered(lambda inv: inv.move_type == 'out_invoice')
# # Get all invoice names (numbers) in a list
# invoice_names = invoices.mapped('name')
if partner:
# Get restriction period (in days) from config parameters
sudo_conf = self.env['ir.config_parameter'].sudo()
restriction_period = sudo_conf.get_param('odex_takaful.restriction_period')
# if partner:
# # Get restriction period (in days) from config parameters
# sudo_conf = self.env['ir.config_parameter'].sudo()
# restriction_period = sudo_conf.get_param('odex_takaful.restriction_period')
try:
restriction_period = int(restriction_period or 0)
except (TypeError, ValueError):
restriction_period = 0
# try:
# restriction_period = int(restriction_period or 0)
# except (TypeError, ValueError):
# restriction_period = 0
if restriction_period and restriction_period > 0:
limit_date = date.today() - timedelta(days=restriction_period)
domain = [
('partner_id', '=', partner.id),
('date', '>=', limit_date),
]
else:
# If no restriction configured, just filter by partner
domain = [('partner_id', '=', partner.id)]
# if restriction_period and restriction_period > 0:
# limit_date = date.today() - timedelta(days=restriction_period)
# domain = [
# ('partner_id', '=', partner.id),
# ('date', '>=', limit_date),
# ]
# else:
# # If no restriction configured, just filter by partner
# domain = [('partner_id', '=', partner.id)]
# Add filter for ref field to match invoice names if we have any
if invoice_names:
domain.append(('ref', 'in', invoice_names))
# # Add filter for ref field to match invoice names if we have any
# if invoice_names:
# domain.append(('ref', 'in', invoice_names))
# # If we have a domain, fetch the matching payments and store them
# # in the helper field, then use their IDs as the domain.
# if domain:
# payments = self.env['account.payment'].search(domain)
# rec.allowed_payment_ids = payments
# return {'domain': {'payment_ids': [('id', 'in', payments.ids)]}}
# else:
# rec.allowed_payment_ids = False
# return {'domain': {'payment_ids': []}}
# If we have a domain, fetch the matching payments and store them
# in the helper field, then use their IDs as the domain.
if domain:
payments = self.env['account.payment'].search(domain)
rec.allowed_payment_ids = payments
return {'domain': {'payment_ids': [('id', 'in', payments.ids)]}}
else:
rec.allowed_payment_ids = False
return {'domain': {'payment_ids': []}}
def action_confirm_refund(self):
for rec in self:
user = rec.sponsor_id.sponsor_id.kafel_id
if user:
user.generate_otp()
sponsor_phone = rec.mobile
if sponsor_phone:
company_id = rec.env.company
# Generate OTP & send it
otp = 1111
if company_id.sms_mode == 'test':
_logger.info(f"--- SMS TEST MODE --- OTP for mobile {sponsor_phone} is {otp}. SMS not sent.")
else:
otp = str(random.randint(1000, 9999))
payload = {
"recipients": [sponsor_phone],
"body": f"Your OTP code is: {otp}",
"sender": company_id.sms_sender_name,
}
headers = {
"Authorization": f"Bearer {company_id.sms_api_token}",
"Content-Type": "application/json",
}
try:
response = requests.post(company_id.sms_api_url, json=payload, headers=headers, timeout=10)
response.raise_for_status() # Raise an error for non-2xx responses
_logger.info(f"OTP {otp} sent successfully to {sponsor_phone}")
except requests.exceptions.RequestException as e:
_logger.error(f"Failed to send OTP to {sponsor_phone}: {e}")
raise ValidationError("Failed to send OTP. Please check API configuration or try again later.")
##################
context = dict(self.env.context or {})
context['default_user_id'] = user.id
context['default_otp'] = user.otp_code
context['default_esterdad_id'] = rec.id
# context['default_user_id'] = user.id
context['default_otp'] = otp
context['default_esterdad_id'] = rec.id
context['default_invoice_ids'] = rec.journal_entry_ids.ids
context['default_cancel_reason'] = rec.cancel_reason.name if not rec.another_reason else rec.reason
rec.sponsor_id.write({
'cancel_record_id': rec.id
})
context['default_payment_ids'] = [(6, 0, rec.payment_ids.ids)]
if rec.sponsor_id.sponsor_or_donor_type == 'unknown' and not rec.sponsor_id.sponsor_phone:
rec.sponsor_id.sponsor_phone = rec.mobile
# context['default_payment_ids'] = [(6, 0, rec.payment_ids.ids)]
view = self.env.ref('odex_takaful.view_otp_wizard_form')
return {
'name': _('OTP Confirmation'),
@ -119,17 +162,12 @@ class EsterdadWizard(models.Model):
'context': context,
}
else:
raise UserError(_("No user assigned to this sponsor"))
raise UserError(_("Mobile is required!"))
@api.depends('sponsor_id.donations_details_lines', 'sponsor_id.donations_details_lines_mechanism_ids')
@api.depends('payment_ids')
def _get_total_sponsorship_amount(self):
for rec in self:
if rec.sponsor_id:
rec.amount = (
sum(line.total_donation_amount for line in rec.sponsor_id.donations_details_lines) +
sum(line.total_donation_amount for line in rec.sponsor_id.donations_details_lines_mechanism_ids)
)
rec.amount = sum(rec.payment_ids.mapped('amount'))
class OTPWizard(models.TransientModel):
@ -138,11 +176,13 @@ class OTPWizard(models.TransientModel):
otp = fields.Integer()
otp_code = fields.Integer()
esterdad_id = fields.Many2one('esterdad.wizard')
user_id = fields.Many2one('res.users')
payment_ids = fields.Many2many(
'account.payment',
string="Payments"
)
# user_id = fields.Many2one('res.users')
invoice_ids = fields.Many2many('account.move')
# payment_ids = fields.Many2many(
# 'account.payment',
# string="Payments"
# )
cancel_reason = fields.Text()
def action_confirm_otp(self):
for rec in self:
@ -150,21 +190,21 @@ class OTPWizard(models.TransientModel):
sponsor_ship = rec.esterdad_id.sponsor_id
rec.esterdad_id.cancel_date = date.today()
if sponsor_ship:
# Get ref values from selected payments
payment_refs = rec.payment_ids.mapped('ref')
# Filter out empty/False refs
payment_refs = [ref for ref in payment_refs if ref]
# # Get ref values from selected payments
# payment_refs = rec.payment_ids.mapped('ref')
# # Filter out empty/False refs
# payment_refs = [ref for ref in payment_refs if ref]
if not payment_refs:
raise UserError(_("No references found in selected payments"))
# if not payment_refs:
# raise UserError(_("No references found in selected payments"))
# Search for invoices in account.move matching payment refs
invoices = self.env['account.move'].search([
('name', 'in', payment_refs),
])
if not invoices:
# # Search for invoices in account.move matching payment refs
# invoices = self.env['account.move'].search([
# ('name', 'in', payment_refs),
# ])
if not rec.invoice_ids:
raise UserError(_("No invoices matching the specified references"))
for invoice in invoices:
for invoice in rec.invoice_ids:
credit = self.env['account.move.reversal'].with_company(self.env.user.company_id.id).create({
'refund_method': 'refund',
'date': date.today(),
@ -181,7 +221,11 @@ class OTPWizard(models.TransientModel):
})
credit_note = self.env['account.move'].search([('id', '=', last_id)])
credit_note.action_post()
credit_note.esterdad_id = rec.esterdad_id
credit_note.write({
'esterdad_id': rec.esterdad_id.id,
'sponsorship_cancel_reason': rec.cancel_reason
})
rec.esterdad_id.confirmed = True
rec.esterdad_id.sponsor_id.is_canceled_refund = True

View File

@ -21,6 +21,17 @@
<field name="arch" type="xml">
<form string="Esterdad Wizard" create="0" edit="0">
<sheet>
<field name="allowed_journal_entry_ids" invisible="1" />
<h2>Invoices</h2>
<field name="journal_entry_ids" nolabel="1" widget="many2many" colspan="2" options="{'no_open': True}">
<tree create="0" edit="0">
<field name="state" invisible="1" />
<field name="invoice_date"/>
<field name="name"/>
<field name="payment_reference"/>
<field name="amount_total"/>
</tree>
</field>
<group>
<field name="amount"/>
<field name="confirmed" invisible="1"/>
@ -33,7 +44,7 @@
<field name="reason" attrs="{'invisible': [('another_reason', '=', False)],
'required': [('another_reason', '=', True)]}"/>
<field name="sponsor_id" invisible="1"/>
<field name="allowed_payment_ids" widget="many2many_tags" invisible="1"/>
<!-- <field name="allowed_payment_ids" widget="many2many_tags" invisible="1"/> -->
</group>
<notebook>
<page string="بيانات المتبرع">
@ -45,7 +56,7 @@
</page>
<page string="Payment Details" groups="odex_takaful.group_refund_approval">
<field name="payment_ids">
<tree editable="1" >
<tree create="0" delete="0" editable="bottom">
<field name="date" readonly="1"/>
<field name="name" readonly="1"/>
@ -55,13 +66,13 @@
readonly="1"/>
<field name="state" readonly="1"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="confirm_payment_refund"
<field name="confirm_payment_refund" widget="binary"
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
<field name="IBN_number"
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
<field name="confirm_payment_refund_image"
<field name="confirm_payment_refund_image" widget="binary"
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
<field name="payment_method_line_id_type"/>

View File

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
class GlobalExtensionWizard(models.TransientModel):
_name = 'global.extension.wizard'
_description = 'Global Extension Wizard'
line_ids = fields.Many2many(
comodel_name='donations.details.lines',
string='Donation Lines'
)
@api.model
def create(self, vals):
return super(GlobalExtensionWizard, self.sudo()).create(vals)
def action_confirm(self):
wizard_sudo = self.sudo()
return {
'type': 'ir.actions.act_window',
'name': ('Extend Donation'),
'res_model': 'donation.extension.wizard',
'view_mode': 'form',
'target': 'new',
'context': {
'donation_detail_ids': wizard_sudo.line_ids.ids,
'no_quick_close': True,
'wizard_force_show_all': True
},
}

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="donations_conditional_tree_odex_takaful" model="ir.ui.view">
<field name="name">donations.details.lines.view.form.inherit</field>
<field name="model">donations.details.lines</field>
<field name="inherit_id" ref="odex_takaful.donations_conditional_tree"/>
<field name="mode">primary</field>
<field name="active">False</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='donation_amount']" position="replace" />
<xpath expr="//field[@name='family_id']" position="replace">
<field name="benefit_id" />
</xpath>
</field>
</record>
<record id="view_global_extension_wizard_form" model="ir.ui.view">
<field name="name">global.extension.wizard.form</field>
<field name="model">global.extension.wizard</field>
<field name="arch" type="xml">
<form string="Global Extension" create="false" edit="false">
<sheet>
<notebook>
<page string="Donation Lines">
<field name="line_ids" options="{'no_create': True, 'no_open': True, 'no_create_edit': True}"
context="{
'wizard_force_show_all': True,
'active_test': False,
'tree_view_ref': 'odex_takaful.donations_conditional_tree_odex_takaful'
}"
domain="[
('record_type', '=', 'sponsorship'),
('sponsorship_duration', '=', 'temporary'),
('state', 'in', ['active', 'replace'])
]">
<tree string="Donation Lines">
<field name="sequence_no"/>
<field name="sponsor_id"/>
<field name="benefit_id"/>
<field name="product_template_id"/>
<field name="create_date"/>
<field name="branch_custom_id"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<footer>
<button name="action_confirm"
string="Confirm"
type="object"
class="btn-primary"/>
<button string="Cancel"
class="btn-secondary"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_global_extension_wizard" model="ir.actions.act_window">
<field name="name">Global Extension</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">global.extension.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_global_extension_wizard_form"/>
<field name="target">new</field>
<field name="context">{
'wizard_force_show_all': True,
'active_test': False
}</field>
</record>
</data>
</odoo>

View File

@ -34,7 +34,8 @@ class ReplaceBenefitWizard(models.TransientModel):
domain = expression.AND([domain, [
('member_status', '=', 'benefit'),
('sponsor_related_id', '=', False),
('general_restriction', '=', False)
('general_restriction', '=', False),
('allowed_sponsorship', '=', True)
]])
if rec.sponsorship_id.sponsorship_duration == 'temporary':
@ -48,7 +49,7 @@ class ReplaceBenefitWizard(models.TransientModel):
('age', '>=', benefit_age_limit)
]])
members = self.env['family.member'].sudo().search(domain)
members = self.env['family.member'].search(domain)
rec.members_domain_ids = members if members else self.env['family.member'].sudo().browse()

View File

@ -15,8 +15,7 @@
<field name="new_members_id"
attrs="{'invisible': [('record_type', '=', 'donation')], 'required': [('record_type', '=', 'sponsorship')]}"
options="{'no_create': True, 'no_create_edit':True,'no_open': True}"
context="{'group_by': 'benefit_group', 'show_age_in_kafalat': True}"
domain="[('allowed_sponsorship', '=', True)]"/>
context="{'group_by': 'benefit_group', 'show_age_in_kafalat': True}"/>
</group>
</group>
<group string="Replacement Reason">