Merge branch 'dev_odex25_takaful' into orphan_report

This commit is contained in:
Tahir Hassan 2026-01-04 13:31:29 +04:00 committed by GitHub
commit 36ec79d8cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 279 additions and 78 deletions

View File

@ -32,6 +32,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -61,6 +62,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -90,6 +92,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -120,6 +123,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -149,6 +153,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -178,6 +183,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -206,6 +212,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project
@ -235,6 +242,7 @@ jobs:
github.actor == 'altexp' || github.actor == 'altexp' ||
github.actor == 'kchyounes19' || github.actor == 'kchyounes19' ||
github.actor == 'maltayyar2' || github.actor == 'maltayyar2' ||
github.actor == 'SamirLADOUI-sa' ||
github.actor == 'mohammed-alkhazrji') github.actor == 'mohammed-alkhazrji')
steps: steps:
- name: Checkout And Restart Project - name: Checkout And Restart Project

View File

@ -54,7 +54,9 @@ jobs:
"abdurrahman-saber", "abdurrahman-saber",
"maltayyar2", "maltayyar2",
"esam-sermah", "esam-sermah",
"mohammed-alkhazrji" "mohammed-alkhazrji",
"SamirLADOUI-sa",
"NossibaElhadi"
]; ];
const pr = context.payload.pull_request; const pr = context.payload.pull_request;

View File

@ -12,6 +12,9 @@
'odex_benefit', 'odex_benefit',
'account', 'account',
'phone_validation', 'phone_validation',
'ensan_sale_management',
'dev_membership',
'branch',
# 'analytic_account', # 'analytic_account',
], ],
'data': [ 'data': [
@ -20,6 +23,10 @@
'data/sequence_data.xml', 'data/sequence_data.xml',
'data/scheduled_actions.xml', 'data/scheduled_actions.xml',
'views/reports_paperformats.xml',
'views/reports_templates.xml',
'views/reports_actions.xml',
'reports/sponsorship_receipt_report.xml',
'data/takaful_notification_mail_template.xml', 'data/takaful_notification_mail_template.xml',
'data/sponsorship_states_data.xml', 'data/sponsorship_states_data.xml',
'data/sponsorship_notification_data.xml', 'data/sponsorship_notification_data.xml',
@ -53,9 +60,6 @@
'views/takaful_conf.xml', 'views/takaful_conf.xml',
'views/sponsorship_states.xml', 'views/sponsorship_states.xml',
'views/takaful_notification.xml', 'views/takaful_notification.xml',
'views/reports_paperformats.xml',
'views/reports_templates.xml',
'views/reports_actions.xml',
'reports/month_payment_template.xml', 'reports/month_payment_template.xml',
'reports/sponsorship_receipt_report.xml', 'reports/sponsorship_receipt_report.xml',
'reports/orphan_mother_report.xml', 'reports/orphan_mother_report.xml',
@ -73,10 +77,10 @@
'views/donation_extension_history_views.xml', 'views/donation_extension_history_views.xml',
'views/donation_replacement_log_views.xml', 'views/donation_replacement_log_views.xml',
'views/sponsorship_scheduling_line.xml', 'views/sponsorship_scheduling_line.xml',
'views/takaful_menus_actions.xml',
'views/preferred_communication.xml', 'views/preferred_communication.xml',
'views/takaful_payment_method.xml', 'views/takaful_payment_method.xml',
'views/product_views.xml', 'views/product_views.xml',
'views/takaful_menus_actions.xml',
'data/message_template_data.xml', 'data/message_template_data.xml',
'data/server_actions.xml', 'data/server_actions.xml',

View File

@ -73,8 +73,8 @@
<p> <p>
Dear ${ctx.get('partner_name')}, Dear ${ctx.get('partner_name')},
</p> </p>
<p> <p>
<strong>${ctx.get('body')}</strong> <strong>${ctx.get('body')}</strong>
</p> </p>

View File

@ -1168,7 +1168,7 @@ msgstr "نوع الإلغاء"
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__canceled #: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__canceled
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search #: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
msgid "Canceled" msgid "Canceled"
msgstr "ملغاة" msgstr "مستردة"
#. module: odex_takaful #. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.kafalat_cancel_report_pdf #: model_terms:ir.ui.view,arch_db:odex_takaful.kafalat_cancel_report_pdf
@ -1206,7 +1206,7 @@ msgstr "نوع الإلغاء"
#. module: odex_takaful #. module: odex_takaful
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_cancellation__state__cancel #: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_cancellation__state__cancel
msgid "Cancelled" msgid "Cancelled"
msgstr "ملغي" msgstr "مستردة"
#. module: odex_takaful #. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_sponsorship_cancellation__cancel_user_id #: model:ir.model.fields,field_description:odex_takaful.field_sponsorship_cancellation__cancel_user_id
@ -4369,15 +4369,11 @@ msgstr "متأخر في سداد الكفالة بنسبة إجمالية %s"
#: model:ir.model.fields.selection,name:odex_takaful.selection__month_payment__state__paid #: model:ir.model.fields.selection,name:odex_takaful.selection__month_payment__state__paid
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_payment__state__paid #: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_payment__state__paid
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_scheduling_line__status__paid #: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_scheduling_line__status__paid
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_states__name__paid
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__paid
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_sponsorship_scheduling_line_search #: model_terms:ir.ui.view,arch_db:odex_takaful.view_sponsorship_scheduling_line_search
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__paid #: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__paid
#, fuzzy #, fuzzy
msgid "Paid" msgid "Paid"
msgstr "" msgstr "منتهي"
"منتهي"
#. module: odex_takaful #. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_grant_benefit_invoice__paid_amount #: model:ir.model.fields,field_description:odex_takaful.field_grant_benefit_invoice__paid_amount
@ -5655,8 +5651,6 @@ msgstr "سجل الكفلاء"
#: model:ir.model.fields,field_description:odex_takaful.field_account_payment__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_account_payment__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_donate_for_another_person__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_donate_for_another_person__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_history__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_history__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__sponsorship_mechanism_id
#: model:ir.model.fields,field_description:odex_takaful.field_month_payment_line__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_month_payment_line__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_payment_details_lines__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_payment_details_lines__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_refund_details_lines__sponsorship_id #: model:ir.model.fields,field_description:odex_takaful.field_refund_details_lines__sponsorship_id
@ -7524,3 +7518,143 @@ msgstr "المستفيد الحالي"
#: model:ir.model,name:odex_takaful.model_replace_benefit_wizard #: model:ir.model,name:odex_takaful.model_replace_benefit_wizard
msgid "Replace Benefit" msgid "Replace Benefit"
msgstr "إستبدال مستفيد" msgstr "إستبدال مستفيد"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__sponsorship_id
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__sponsorship_mechanism_id
msgid "Sponsorship"
msgstr "السجل"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/donation_extension_wizard.py:0
#, python-format
msgid ""
"Only active donations with end date in the future can be extended. Line: %s"
msgstr "التمدد للكفالات النشطة فقط"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
#, python-format
msgid "Machine"
msgstr "الماكينة"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/esterdad.py:0
#, python-format
msgid "No user assigned to this sponsor"
msgstr "لا يوجد مستخدم مخصص لهذا الكفيل"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/esterdad.py:0
#, python-format
msgid "No references found in selected payments"
msgstr "لا توجد مراجع في الدفعات المحددة"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/esterdad.py:0
#, python-format
msgid "No invoices matching the specified references"
msgstr "لا توجد فواتير مطابقة للمراجع المحددة"
#. module: odex_takaful
#: code:addons/odex_takaful/wizards/esterdad.py:0
#, python-format
msgid "The entered number is incorrect"
msgstr "الرقم المدخل خاطئ"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__waiting_date
msgid "Waiting Date"
msgstr "تاريخ الانتظار"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__actual_end_date
msgid "Waiting Period"
msgstr "مدة الانتظار"
#. module: odex_takaful
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__age_category__all
msgid "All Ages"
msgstr "جميع الأعمار"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__age_category
msgid "Age Category"
msgstr "الفئة العمرية"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid "You cannot do this. The refund period has expired."
msgstr "لا يمكنك القيام بذلك لتجاوز المدة المحددة للاسترداد."
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid ""
"You must create a new subscriber first before saving.\n"
"Click the \"Create Subscriber\" button to add a new subscriber."
msgstr ""
"يجب إنشاء مشترك جديد أولاً قبل الحفظ.\n"
"اضغط على زر \"إنشاء مشترك\" لإضافة مشترك جديد."
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid ""
"You must create a new sponsor first before saving.\n"
"Click the \"Create Subscriber\" button to add a new sponsor."
msgstr ""
"يجب إنشاء كافل جديد أولاً قبل الحفظ.\n"
"اضغط على زر \"إنشاء مشترك\" لإضافة كافل جديد."
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid "Sponsorship Entitlement"
msgstr "إستحقاق كفالة"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid "For the purpose of sponsorship entitlement"
msgstr "بغرض إستحقاق كفالة"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid "Sponsorship"
msgstr "كفالة"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
#, python-format
msgid "Sponsorship Number"
msgstr "كفالة رقم"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_contribution_model.py:0
#, python-format
msgid "Financial Contribution"
msgstr "مساهمة مالية"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_contribution_model.py:0
#, python-format
msgid "Financial contribution for:"
msgstr "مساهمة مالية لصالح:"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_contribution_model.py:0
#, python-format
msgid "Financial contribution by order %s"
msgstr "مساهمة مالية بالأمر %s"
#. module: odex_takaful
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_states__name__paid
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__paid
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
msgid "Paid"
msgstr "تم الدفع"

View File

@ -104,9 +104,9 @@ class DonationsDetailsLines(models.Model):
age = fields.Integer(related='benefit_id.age') age = fields.Integer(related='benefit_id.age')
number_of_family_member = fields.Integer(related='benefit_id.number_of_family_member') number_of_family_member = fields.Integer(related='benefit_id.number_of_family_member')
waiting_date = fields.Date( waiting_date = fields.Date(
string="تاريخ الانتظار", string="Waiting Date",
) )
actual_end_date = fields.Date(string="مدة الانتظار", compute='_compute_actual_end_date', store=True) actual_end_date = fields.Date(string="Waiting Period", compute='_compute_actual_end_date', store=True)
period_display = fields.Char( period_display = fields.Char(
string="Period", string="Period",
compute="_compute_period_display" ) compute="_compute_period_display" )
@ -114,8 +114,8 @@ class DonationsDetailsLines(models.Model):
age_category = fields.Selection([ age_category = fields.Selection([
('18', '+18'), ('18', '+18'),
('16', '+16'), ('16', '+16'),
('all', 'جميع الأعمار'), ('all', 'All Ages'),
], string="الفئة العمرية", compute="_compute_age_category") ], string="Age Category", compute="_compute_age_category")
direct_debit_filter = fields.Selection( direct_debit_filter = fields.Selection(
[ [
@ -165,7 +165,7 @@ class DonationsDetailsLines(models.Model):
user.has_group('odex_takaful.branch_manager_group')) user.has_group('odex_takaful.branch_manager_group'))
print('is_manager >>>> ' , is_manager) print('is_manager >>>> ' , is_manager)
print('rec.create_uid >>>> ' , rec.create_uid) print('rec.create_uid >>>> ' , rec.create_uid)
rec.can_edit_benefit = (rec.create_uid == user or is_manager) rec.can_edit_benefit = (rec.create_uid == user or is_manager) and rec.state == 'waiting' and not rec.benefit_id
@api.depends('sponsorship_duration', 'payment_month_count', 'direct_debit') @api.depends('sponsorship_duration', 'payment_month_count', 'direct_debit')
def _compute_age_category(self): def _compute_age_category(self):
for rec in self: for rec in self:
@ -317,7 +317,7 @@ class DonationsDetailsLines(models.Model):
@api.depends('sponsorship_duration', 'direct_debit', 'record_type', 'start_date') @api.depends('sponsorship_duration', 'direct_debit', 'record_type', 'start_date')
def _compute_hide_beneficiary_group(self): def _compute_hide_beneficiary_group(self):
for rec in self: for rec in self:
if rec.sponsorship_duration == 'temporary' and rec.direct_debit and rec.record_type == 'sponsorship' and rec.start_date != fields.Date.context_today( if rec.sponsorship_duration == 'temporary' and rec.direct_debit and rec.record_type == 'sponsorship' and rec.start_date > fields.Date.context_today(
rec): rec):
rec.hide_beneficiary_group = True rec.hide_beneficiary_group = True
else: else:
@ -362,6 +362,7 @@ class DonationsDetailsLines(models.Model):
rec.state = 'paid' rec.state = 'paid'
else: else:
rec.state = 'active' rec.state = 'active'
rec.start_date = fields.Date.today()
sponsor_id = rec.sponsorship_mechanism_id.sponsor_id.id if rec.sponsorship_mechanism_id else rec.sponsorship_id.sponsor_id.id sponsor_id = rec.sponsorship_mechanism_id.sponsor_id.id if rec.sponsorship_mechanism_id else rec.sponsorship_id.sponsor_id.id
(rec.benefit_id | rec.benefit_ids).write( (rec.benefit_id | rec.benefit_ids).write(
@ -1235,7 +1236,10 @@ class DonationsDetailsLines(models.Model):
}) })
all_beneficiaries = ended_lines.benefit_ids | ended_lines.benefit_id all_beneficiaries = ended_lines.benefit_ids | ended_lines.benefit_id
all_beneficiaries.write({ all_beneficiaries.write({
'sponsor_related_id': False 'sponsor_related_id': False,
'kafala_status':'have_not_kafala',
'sponsorship_end_date': fields.Date.today(),
}) })
for line in ended_lines: for line in ended_lines:
line._message_sms_with_template( line._message_sms_with_template(

View File

@ -56,8 +56,15 @@ class ResPartner(models.Model):
check_lines = fields.Boolean() check_lines = fields.Boolean()
def _get_default_preferred_communication(self): def _get_default_preferred_communication(self):
"""Get first preferred communication method as default""" """Get first preferred communication method as default"""
first_comm = self.env['preferred.communication'].search([], limit=1, order='id asc') # Check if table exists before searching (safe during module installation)
return first_comm if first_comm else False from odoo.tools import sql
if not sql.table_exists(self.env.cr, 'preferred_communication'):
return False
try:
first_comm = self.env['preferred.communication'].search([], limit=1, order='id asc')
return first_comm.id if first_comm else False
except Exception:
return False
preferred_communication = fields.Many2one('preferred.communication', string="Preferred Communication", default=_get_default_preferred_communication) preferred_communication = fields.Many2one('preferred.communication', string="Preferred Communication", default=_get_default_preferred_communication)
serial_code = fields.Char(string="Serial Code", readonly=True, copy=False) serial_code = fields.Char(string="Serial Code", readonly=True, copy=False)

View File

@ -97,8 +97,8 @@ class TakafulContribution(models.Model):
'partner_id': partner_id.id, 'partner_id': partner_id.id,
'partner_invoice_id': partner_id.id, 'partner_invoice_id': partner_id.id,
'partner_shipping_id': partner_id.id, 'partner_shipping_id': partner_id.id,
'client_order_ref': u'مساهمة مالية', 'client_order_ref': _('Financial Contribution'),
'note': u'مساهمة مالية لصالح:' + '\n' + (self.benefit_id.name if self.benefit_id else ""), 'note': _('Financial contribution for:') + '\n' + (self.benefit_id.name if self.benefit_id else ""),
'order_line': this_products_line 'order_line': this_products_line
}) })
@ -108,7 +108,7 @@ class TakafulContribution(models.Model):
inv = self.env['account.move'].browse(inv_id) inv = self.env['account.move'].browse(inv_id)
inv.journal_id = int(journal_id) inv.journal_id = int(journal_id)
move_name = u'مساهمة مالية بالأمر %s' % inv.origin move_name = _('Financial contribution by order %s') % inv.origin
ctx = self.env.context.copy() ctx = self.env.context.copy()
ctx.update({'sponsorship' : { ctx.update({'sponsorship' : {
'name': move_name, 'name': move_name,

View File

@ -132,6 +132,10 @@ class TakafulSponsorship(models.Model):
record_url = fields.Char(string="Record URL", readonly=True) record_url = fields.Char(string="Record URL", readonly=True)
is_canceled_refund = fields.Boolean() is_canceled_refund = fields.Boolean()
def _sms_get_number_fields(self):
return ['sponsor_phone']
@api.depends('is_canceled_refund') @api.depends('is_canceled_refund')
def cancel_refund_tamded(self): def cancel_refund_tamded(self):
for rec in self: for rec in self:
@ -225,7 +229,7 @@ class TakafulSponsorship(models.Model):
'context': context, 'context': context,
} }
else: else:
raise UserError("لا يمكنك القيام بذلك لتجاوز المدة المحددة للاسترداد.") raise UserError(_("You cannot do this. The refund period has expired."))
@ -539,7 +543,7 @@ class TakafulSponsorship(models.Model):
pass pass
def _default_branch_custom_id(self): def _default_branch_custom_id(self):
return self.env['branch.settings'].sudo().search([('branch', '=', self.env.user.department_id.id)], limit=1) return self.env.user.branch_custom_id
# @api.constrains('payment_details_lines') # @api.constrains('payment_details_lines')
# def check_payment_amount(self): # def check_payment_amount(self):
@ -609,6 +613,12 @@ class TakafulSponsorship(models.Model):
rec.donations_details_lines.mapped('benefit_ids').ids + rec.donations_details_lines.mapped('benefit_ids').ids +
rec.donations_details_lines_mechanism_ids.mapped('benefit_ids').ids rec.donations_details_lines_mechanism_ids.mapped('benefit_ids').ids
) )
@api.onchange('benefit_ids')
def onchange_benefit_ids(self):
if not self.benefit_ids:
self.benefit_id = False
@api.depends('gender','education_status','education_level','sponsorship_type','benefit_type','age_category_id') @api.depends('gender','education_status','education_level','sponsorship_type','benefit_type','age_category_id')
def _compute_domain_ids(self): def _compute_domain_ids(self):
# Create a domain # Create a domain
@ -916,14 +926,14 @@ class TakafulSponsorship(models.Model):
# Check for donation with new_sponsor # Check for donation with new_sponsor
if record_type == 'donation' and sponsor_or_donor_type == 'new_sponsor' and not sponsor_id: if record_type == 'donation' and sponsor_or_donor_type == 'new_sponsor' and not sponsor_id:
raise ValidationError(_( raise ValidationError(_(
'يجب إنشاء مشترك جديد أولاً قبل الحفظ.\n' 'You must create a new subscriber first before saving.\n'
'اضغط على زر "إنشاء مشترك" لإضافة مشترك جديد.' 'Click the "Create Subscriber" button to add a new subscriber.'
)) ))
# Check for sponsorship with new_sponsor # Check for sponsorship with new_sponsor
elif record_type == 'sponsorship' and sponsor_donor_type == 'new_sponsor' and not sponsor_id: elif record_type == 'sponsorship' and sponsor_donor_type == 'new_sponsor' and not sponsor_id:
raise ValidationError(_( raise ValidationError(_(
'يجب إنشاء كافل جديد أولاً قبل الحفظ.\n' 'You must create a new sponsor first before saving.\n'
'اضغط على زر "إنشاء مشترك" لإضافة كافل جديد.' 'Click the "Create Subscriber" button to add a new sponsor.'
)) ))
# If validation passed, create the record # If validation passed, create the record
@ -975,6 +985,9 @@ class TakafulSponsorship(models.Model):
res.update({ res.update({
'record_url': url, 'record_url': url,
}) })
res.update({
'branch_custom_id': self.env.user.branch_custom_id.id ,
})
return res return res
# payment_ids = fields.One2many('account.payment','sponsorship_id',string='Payments', copy=False) # payment_ids = fields.One2many('account.payment','sponsorship_id',string='Payments', copy=False)
@ -1063,10 +1076,10 @@ class TakafulSponsorship(models.Model):
'journal_id': journal.id, 'journal_id': journal.id,
'currency_id': journal.currency_id.id or company_id.currency_id.id or currency_id.id, 'currency_id': journal.currency_id.id or company_id.currency_id.id or currency_id.id,
# journal.currency_id.id # journal.currency_id.id
'name': u'إستحقاق كفالة' + ' - ' + self.code, 'name': _('Sponsorship Entitlement') + ' - ' + self.code,
'account_id': account_receivable.id, # account_id or 'account_id': account_receivable.id, # account_id or
'type': 'out_invoice', 'type': 'out_invoice',
'comment': u'بغرض إستحقاق كفالة', 'comment': _('For the purpose of sponsorship entitlement'),
'date_invoice': next_date, 'date_invoice': next_date,
}) })
@ -1077,8 +1090,8 @@ class TakafulSponsorship(models.Model):
# Update product: # Update product:
product_id.sudo().write({ product_id.sudo().write({
"list_price": self.contribution_value, "list_price": self.contribution_value,
"name": u'كفالة' + ' ' + self.code, "name": _('Sponsorship') + ' ' + self.code,
'description_sale': u'كفالة رقم ' + self.code, 'description_sale': _('Sponsorship Number') + ' ' + self.code,
}) })
# Create line # Create line
@ -1088,7 +1101,7 @@ class TakafulSponsorship(models.Model):
'quantity': 1, 'quantity': 1,
'price_unit': self.contribution_value, 'price_unit': self.contribution_value,
'invoice_id': invoice_id.id, 'invoice_id': invoice_id.id,
'name': u'كفالة رقم ' + self.code, 'name': _('Sponsorship Number') + ' ' + self.code,
'account_id': account_revenue.id, 'account_id': account_revenue.id,
# "invoice_line_tax_ids": [], # "invoice_line_tax_ids": [],
}) })
@ -1304,6 +1317,12 @@ class TakafulSponsorship(models.Model):
def action_set_close(self): def action_set_close(self):
self.ensure_one() self.ensure_one()
self.state = 'closed' self.state = 'closed'
all_line = self.donations_details_lines + self.donations_details_lines_mechanism_ids
for line in all_line:
line.state = 'closed'
line.benefit_id.kafala_status = 'have_not_kafala'
line.benefit_id.sponsor_related_id = False
line.benefit_id.sponsorship_end_date = fields.Date.today()
# @api.multi # @api.multi
def action_make_payement(self): def action_make_payement(self):
@ -1987,7 +2006,7 @@ class PaymentDetailsLines(models.Model):
charity_journal_id = fields.Many2one('account.journal', string="charity Bank",related = 'points_of_sale.journal_id') charity_journal_id = fields.Many2one('account.journal', string="charity Bank",related = 'points_of_sale.journal_id')
name = fields.Char(string="Ref.",readonly=True) name = fields.Char(string="Ref.",readonly=True)
check_number = fields.Char(string='Check Number') check_number = fields.Char(string='Check Number')
account_payment_method = fields.Many2one('account.payment.method.line',domain="[('payment_type','=','inbound')]",string='Account Payment Method') account_payment_method = fields.Many2one('account.payment.method.line', string='Account Payment Method')
branch_custom_id = fields.Many2one('branch.settings', string="Branch",related='sponsorship_id.branch_custom_id') branch_custom_id = fields.Many2one('branch.settings', string="Branch",related='sponsorship_id.branch_custom_id')
sponsor_account_number = fields.Char(string='Sponsor Account Number') sponsor_account_number = fields.Char(string='Sponsor Account Number')
sa_iban = fields.Char('SA',default='SA',readonly=True) sa_iban = fields.Char('SA',default='SA',readonly=True)

View File

@ -30,8 +30,5 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem id="menu_preferred_communication" <!-- Menu moved to takaful_menus_actions.xml -->
name="Preferred Communication"
parent="odex_takaful.sponsor_setting_menu"
action="action_preferred_communication"/>
</odoo> </odoo>

View File

@ -88,10 +88,7 @@
</field> </field>
</record> </record>
<!-- Menu Item --> <!-- Menu moved to takaful_menus_actions.xml to avoid circular dependency -->
<menuitem id="menu_replacement_root" name="Kafala Processes" sequence="11"
parent="odex_takaful.takaful_kufula_app_top_menu" groups="odex_takaful.group_orphan_replacement"/>
<!-- <menuitem id="menu_replacement_process"--> <!-- <menuitem id="menu_replacement_process"-->
<!-- name="Orphan Replacement"--> <!-- name="Orphan Replacement"-->
<!-- parent="menu_replacement_root"--> <!-- parent="menu_replacement_root"-->

View File

@ -33,6 +33,5 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<!-- Menu --> <!-- Menu moved to takaful_menus_actions.xml to avoid circular dependency -->
<menuitem id="menu_replacement_reasons" name="Replacement Reasons" parent="odex_takaful.takaful_app_top_menu" action="action_replacement_reasons" groups="odex_takaful.group_orphan_replacement"/>
</odoo> </odoo>

View File

@ -32,8 +32,6 @@
</field> </field>
</record> </record>
<menuitem id="menu_sponsorship_states_items" name="Sponsorship States" <!-- Menu moved to takaful_menus_actions.xml -->
parent="sponsor_setting_menu"
action="sponsorship_states_action"/>
</odoo> </odoo>

View File

@ -92,12 +92,6 @@
</field> </field>
</record> </record>
<menuitem id="menu_donations_items" name="Donations Items" <!-- Menu items moved to takaful_menus_actions.xml to avoid circular dependency -->
parent="sponsor_setting_menu"
action="donations_items_action" />
<menuitem id="menu_points_of_sale_custom" name="Points of Sale"
parent="sponsor_setting_menu"
action="points_of_sale_custom_action" />
</data> </data>
</odoo> </odoo>

View File

@ -7,6 +7,10 @@
<menuitem id="kafalat_main_menu" parent="takaful_kufula_app_top_menu" <menuitem id="kafalat_main_menu" parent="takaful_kufula_app_top_menu"
sequence="10" name="Kafalat"/> sequence="10" name="Kafalat"/>
<!-- Kafala Processes (moved from replacement_process_views.xml) -->
<menuitem id="menu_replacement_root" name="Kafala Processes" sequence="11"
parent="takaful_kufula_app_top_menu" groups="odex_takaful.group_kufula_user"/>
<menuitem id="takaful_sponsorship_app_menu" parent="kafalat_main_menu" <menuitem id="takaful_sponsorship_app_menu" parent="kafalat_main_menu"
name="Sponsorships" action="takaful_sponsorship_action" sequence="1"/> name="Sponsorships" action="takaful_sponsorship_action" sequence="1"/>
@ -14,7 +18,7 @@
name="Donations Details Lines" action="donations_details_lines_action" sequence="2"/> name="Donations Details Lines" action="donations_details_lines_action" sequence="2"/>
<menuitem id="donations_details_lines_to_replace_app_menu" parent="menu_replacement_root" <menuitem id="donations_details_lines_to_replace_app_menu" parent="menu_replacement_root"
name="Donations Details Lines To Replace Benefit" action="donations_details_lines_replace_action" sequence="3"/> name="Donations Details Lines To Replace Benefit" action="donations_details_lines_replace_action" sequence="3" groups="odex_takaful.group_orphan_replacement"/>
<menuitem id="donations_details_lines_waiting_app_menu" parent="menu_replacement_root" <menuitem id="donations_details_lines_waiting_app_menu" parent="menu_replacement_root"
name="Donations Details Lines Waiting Benefit" action="donations_details_lines_waiting_action" sequence="4"/> name="Donations Details Lines Waiting Benefit" action="donations_details_lines_waiting_action" sequence="4"/>
@ -118,9 +122,37 @@
name="Messages Templates" name="Messages Templates"
parent="odex_takaful.sponsor_setting_menu" parent="odex_takaful.sponsor_setting_menu"
action="odex_takaful.takaful_message_template_action" action="odex_takaful.takaful_message_template_action"
sequence="3"/> sequence="3" active="False"/>
<!-- Menu items moved from takaful_conf.xml -->
<menuitem id="menu_donations_items" name="Donations Items"
parent="sponsor_setting_menu"
action="donations_items_action"
sequence="4" active="False"/>
<menuitem id="menu_points_of_sale_custom" name="Points of Sale"
parent="sponsor_setting_menu"
action="points_of_sale_custom_action"
sequence="5" active="False"/>
<!-- Menu moved from sponsorship_states.xml -->
<menuitem id="menu_sponsorship_states_items" name="Sponsorship States"
parent="sponsor_setting_menu"
action="sponsorship_states_action"
sequence="6" active="False"/>
<!-- Menu moved from preferred_communication.xml -->
<menuitem id="menu_preferred_communication" name="Preferred Communication"
parent="sponsor_setting_menu"
action="action_preferred_communication"
sequence="7"/>
<!-- Menu moved from takaful_payment_method.xml -->
<menuitem id="menu_takaful_payment_method" name="Takaful Payment Method"
parent="sponsor_setting_menu"
action="action_takaful_payment_method"
sequence="8"/>
<!-- Begin Kufala Settings --> <!-- Begin Kufala Settings -->
<menuitem id="takaful_app_top_menu" parent="sponsor_setting_menu" sequence="99" <menuitem id="takaful_app_top_menu" parent="sponsor_setting_menu" sequence="99"
@ -128,11 +160,11 @@
<menuitem id="message_type_menu" action="odex_takaful_base.takaful_message_type_action" <menuitem id="message_type_menu" action="odex_takaful_base.takaful_message_type_action"
name="Message Types" sequence="5" name="Message Types" sequence="5"
parent="takaful_app_top_menu"/> parent="takaful_app_top_menu" active="False"/>
<menuitem id="takaful_notification_menu" action="odex_takaful_base.takaful_notification_action" <menuitem id="takaful_notification_menu" action="odex_takaful_base.takaful_notification_action"
name="Notifications" sequence="10" name="Notifications" sequence="10"
parent="takaful_app_top_menu"/> parent="takaful_app_top_menu" active="False"/>
<record model="ir.ui.menu" id="takaful_app_top_menu"> <record model="ir.ui.menu" id="takaful_app_top_menu">
<field name="groups_id" eval="[(6,0,[ref('odex_takaful.sponsorship_system_manager_group')])]"/> <field name="groups_id" eval="[(6,0,[ref('odex_takaful.sponsorship_system_manager_group')])]"/>
@ -140,6 +172,10 @@
<menuitem id="takaful_settings_menu" name="Kufala Global Settings" <menuitem id="takaful_settings_menu" name="Kufala Global Settings"
parent="takaful_app_top_menu" action="odex_takaful_base.takaful_settings_action" sequence="99"/> parent="takaful_app_top_menu" action="odex_takaful_base.takaful_settings_action" sequence="99"/>
<menuitem id="menu_replacement_reasons" name="Replacement Reasons"
parent="takaful_app_top_menu" action="action_replacement_reasons"
groups="odex_takaful.group_orphan_replacement" sequence="50"/>
<!-- END Kufala Settings --> <!-- END Kufala Settings -->

View File

@ -34,8 +34,5 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem id="menu_takaful_payment_method" <!-- Menu moved to takaful_menus_actions.xml -->
name="Takaful Payment Method"
parent="odex_takaful.sponsor_setting_menu"
action="action_takaful_payment_method"/>
</odoo> </odoo>

View File

@ -46,7 +46,9 @@
<button name="action_set_cancel" type="object" <button name="action_set_cancel" type="object"
string="To Cancel" class="oe_highlight" string="To Cancel" class="oe_highlight"
attrs="{'invisible': [('state','not in',['confirmed'])]}"/> attrs="{'invisible': True}"/>
<!-- attrs="{'invisible': [('state','not in',['confirmed'])]}"-->
<button name="action_reset_to_draft" type="object" <button name="action_reset_to_draft" type="object"
string="Reset to Draft" class="btn-link" string="Reset to Draft" class="btn-link"
attrs="{'invisible': [('state','!=','confirmed')]}"/> attrs="{'invisible': [('state','!=','confirmed')]}"/>

View File

@ -30,7 +30,7 @@ class AccountRegisterPayment(models.TransientModel):
transaction_file_attachment = fields.Binary(string='Transaction Attachment', attachment=False) transaction_file_attachment = fields.Binary(string='Transaction Attachment', attachment=False)
transaction_attachment_file_name = fields.Char('Transaction File Name', required=False) transaction_attachment_file_name = fields.Char('Transaction File Name', required=False)
payment_method = fields.Selection(selection=[("cash", "Cash"), ("bank", "Bank Transfer"), ("check", "Check")], string="Payment Method", required=True, default="cash") payment_method = fields.Selection(selection=[("cash", "Cash"), ("bank", "Bank Transfer"), ("check", "Check")], string="Payment Method", required=True, default="cash")
machine_id = fields.Many2one('geidea.terminals' , 'الماكينة') machine_id = fields.Many2one('geidea.terminals', string=_('Machine'))
check_number = fields.Char(string='Check Number') check_number = fields.Char(string='Check Number')
check_due_date = fields.Date(string='Check Due Date') check_due_date = fields.Date(string='Check Due Date')
sponsorship_payment = fields.Boolean(string='Sponsorship Payment', default=False) sponsorship_payment = fields.Boolean(string='Sponsorship Payment', default=False)

View File

@ -27,7 +27,7 @@
<!-- <attribute name="options">{'skip_disable_quick_create': True}</attribute>--> <!-- <attribute name="options">{'skip_disable_quick_create': True}</attribute>-->
</xpath> </xpath>
<xpath expr="//field[@name='payment_method_line_id']" position="attributes"> <xpath expr="//field[@name='payment_method_id']" position="attributes">
<attribute name="invisible">context.get('sponsorship_payment')</attribute> <attribute name="invisible">context.get('sponsorship_payment')</attribute>
</xpath> </xpath>

View File

@ -119,7 +119,7 @@ class EsterdadWizard(models.Model):
'context': context, 'context': context,
} }
else: else:
raise UserError("لا يوجد مستخدم مخصص لهذا الكفيل") raise UserError(_("No user assigned to this sponsor"))
@api.depends('sponsor_id.donations_details_lines', 'sponsor_id.donations_details_lines_mechanism_ids') @api.depends('sponsor_id.donations_details_lines', 'sponsor_id.donations_details_lines_mechanism_ids')
def _get_total_sponsorship_amount(self): def _get_total_sponsorship_amount(self):
@ -156,14 +156,14 @@ class OTPWizard(models.TransientModel):
payment_refs = [ref for ref in payment_refs if ref] payment_refs = [ref for ref in payment_refs if ref]
if not payment_refs: if not payment_refs:
raise UserError("لا توجد مراجع في الدفعات المحددة") raise UserError(_("No references found in selected payments"))
# Search for invoices in account.move matching payment refs # Search for invoices in account.move matching payment refs
invoices = self.env['account.move'].search([ invoices = self.env['account.move'].search([
('name', 'in', payment_refs), ('name', 'in', payment_refs),
]) ])
if not invoices: if not invoices:
raise UserError("لا توجد فواتير مطابقة للمراجع المحددة") raise UserError(_("No invoices matching the specified references"))
for invoice in invoices: for invoice in invoices:
credit = self.env['account.move.reversal'].with_company(self.env.user.company_id.id).create({ credit = self.env['account.move.reversal'].with_company(self.env.user.company_id.id).create({
'refund_method': 'refund', 'refund_method': 'refund',
@ -191,7 +191,10 @@ class OTPWizard(models.TransientModel):
# Set state to 'cancel' for all donation lines # Set state to 'cancel' for all donation lines
if all_donation_lines: if all_donation_lines:
all_donation_lines.write({'state': 'cancel'}) all_donation_lines.write({'state': 'cancel'})
all_donation_lines.mapped('benefit_id').write({'kafala_status': 'have_not_kafala',
'sponsor_related_id': False,
'sponsorship_end_date': fields.Date.today(),
})
# Process extension history for each donation line # Process extension history for each donation line
for donation_line in all_donation_lines: for donation_line in all_donation_lines:
# Get extension_history_ids for this donation line # Get extension_history_ids for this donation line
@ -217,4 +220,4 @@ class OTPWizard(models.TransientModel):
else: else:
raise UserError("الرقم المدخل خاطئ") raise UserError(_("The entered number is incorrect"))

View File

@ -50,7 +50,7 @@
<field name="name" readonly="1"/> <field name="name" readonly="1"/>
<field name="journal_id" readonly="1"/> <field name="journal_id" readonly="1"/>
<field name="payment_method_line_id" readonly="1"/> <field name="payment_method_id" readonly="1"/>
<field name="amount" sum="Amount" <field name="amount" sum="Amount"
readonly="1"/> readonly="1"/>
<field name="state" readonly="1"/> <field name="state" readonly="1"/>