Merge branch 'dev_odex25_ensan' of https://github.com/expsa/odex25-standard-modules into Fix_donation_line_state

This commit is contained in:
Nossibaelhadi 2025-11-12 01:14:34 +03:00
commit fbee06b489
35 changed files with 768 additions and 263 deletions

View File

@ -4529,6 +4529,7 @@ msgid "Done"
msgstr "تمت الزيارة"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.seasonal_service_form_view
#: model:ir.model.fields.selection,name:odex_benefit.selection__payment_orders__state__done
#: model:ir.model.fields.selection,name:odex_benefit.selection__seasonal_service__state__done
msgid "Done"
@ -16513,7 +16514,6 @@ msgstr "إعادة حساب"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_family_bank_report_wizard_form
msgid "Family Monthly Expense"
msgstr "المصروف الشهري للأسر"
@ -16602,17 +16602,6 @@ msgstr "تقرير البنك للأسر"
msgid "Family Bank Report (Excel)"
msgstr "تقرير البنك للأسر (إكسل)"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_family_bank_report_wizard__move_ids
msgid "Monthly Expenses"
msgstr "المصروفات الشهرية"
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/family_bank_report_wizard.py:0
#, python-format
msgid "Please select at least one Monthly Expense."
msgstr "يرجى اختيار مصروف شهري واحد على الأقل."
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/family_bank_report_wizard.py:0
#, python-format
@ -17073,4 +17062,42 @@ msgstr "إجمالي المبلغ"
#: code:addons/odex_benefit/models/payment_order.py:0
#, python-format
msgid "Please select a journal before creating the entry."
msgstr "يرجى اختيار دفتر اليومية قبل إنشاء القيد."
msgstr "يرجى اختيار دفتر اليومية قبل إنشاء القيد."
#. module: odex_benefit
#: model:ir.actions.act_window,name:odex_benefit.action_payment_orders
#: model:ir.model,name:odex_benefit.model_payment_orders
#: model:ir.ui.menu,name:odex_benefit.menu_payment_orders
#: model_terms:ir.ui.view,arch_db:odex_benefit.payment_orders_form
#: model_terms:ir.ui.view,arch_db:odex_benefit.payment_orders_tree
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_family_bank_report_wizard_form
#: model:ir.model.fields,field_description:odex_benefit.field_family_bank_report_wizard__payment_order_ids
msgid "Payment Orders"
msgstr "أوامر صرف الخدمات"
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/family_bank_report_wizard.py:0
#, python-format
msgid "Please select at least one Payment Order."
msgstr "يرجى اختيار أمر صرف واحد على الأقل."
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/family_bank_report_wizard.py:0
#, python-format
msgid "Selected Payment Orders do not reference any posted moves."
msgstr "أوامر الصرف المحددة لا تشير إلى أي قيود منشورة."
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_payment_orders__payment_order_date
msgid "Payment Order Date"
msgstr "تاريخ أمر الصرف"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_payment_orders__payment_order_description
msgid "Payment Order Description"
msgstr "بند الخدمة"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_payment_orders__ref_num
msgid "Ref. Number"
msgstr "المرجع"

View File

@ -208,8 +208,8 @@ class ConfirmBenefitExpense(models.Model):
# Search for conflicting records of the same expense type within the past month
conflicting_records = self.search([
('date', '>=', rec.start_date),
('date', '<=', rec.end_date),
('start_date', '<=', rec.end_date),
('end_date', '>=', rec.start_date),
('expense_type', '=', rec.expense_type),
])
@ -338,52 +338,6 @@ class ConfirmBenefitExpense(models.Model):
# else:
# pay.payment_method_id = False
@api.onchange('expense_type', 'date', 'branch_custom_id', 'start_date', 'end_date')
def _onchange_expense_type(self):
# Define base domain for family selection
validation_setting = self.env["family.validation.setting"].search([], limit=1)
base_domain = ['|', ('state', '=', 'second_approve'), '&',
('state', 'in', ('waiting_approve', 'first_approve')), ('action_type', '=', 'suspended')]
if self.branch_custom_id:
base_domain.append(('branch_custom_id', '=', self.branch_custom_id.id))
min_income = validation_setting.benefit_category_ids.mapped('mini_income_amount')
max_income = validation_setting.benefit_category_ids.mapped('max_income_amount')
base_domain.extend([('member_income', '>=', min(min_income)), ('member_income', '<=', max(max_income))])
base_domain.extend([('benefit_category_id', '!=', False)])
if self.expense_type == 'family_invoice':
base_domain.append(('meal_card', '=', True))
# if self.date:
if self.start_date and self.end_date:
# Calculate the start date for the past month range
month_ago = self.date - relativedelta(months=1)
# Search for conflicting records of the same expense type within the past month
conflicting_records = self.search([
('date', '>=', self.start_date),
('date', '<=', self.end_date),
('expense_type', '=', self.expense_type),
])
if conflicting_records:
# Gather the family IDs that are already associated with the same expense type
conflicting_family_ids = conflicting_records.mapped('family_ids').ids
base_domain.append(('id', 'not in', conflicting_family_ids))
related_records = self.family_ids = self.env['grant.benefit'].search(base_domain)
if related_records and self.branch_custom_id:
self.family_ids = [(6, 0, related_records.ids)] # 6 means 'set' in Many2many
else:
self.family_ids = [(5,)] # Clear the records if source_field is empty
# self.family_ids = self.env['grant.benefit'].search(base_domain).ids
# Return domain restrictions
return {
'domain': {
'family_ids': base_domain,
}
}
def action_accounting_transfer(self):
for rec in self:
validation_setting = self.env["family.validation.setting"].search([], limit=1)
@ -441,7 +395,6 @@ class ConfirmBenefitExpense(models.Model):
}
invoice = self.env['account.move'].create(invoice_vals)
invoice.action_post()
rec.move_id = invoice
return True

View File

@ -7,6 +7,7 @@ class PaymentOrders(models.Model):
_name = 'payment.orders'
_description = "Payment Orders"
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = 'payment_order_date desc'
def _default_journal(self):
setting = self.env['family.validation.setting'].search([], limit=1)

View File

@ -194,6 +194,11 @@ class SeasonalService(models.Model):
rec.state = 'waiting_receive'
rec.service_requests_ids.write({'state': 'send_request_to_supplier'})
def action_done(self):
for rec in self:
rec.state = 'done'
rec.service_requests_ids.write({'state': 'family_received_device'})
def action_create_payment_order(self):
for rec in self:
self.env['payment.orders'].create({

View File

@ -226,12 +226,15 @@ class ServiceRequest(models.Model):
if rec.payment_order_id:
if rec.payment_order_id.state == "done":
payment_order_state = "done"
rec.service_approval_date = fields.Datetime.now()
rec.state = 'send_request_to_supplier'
rec.is_payment_order_done = True
else:
payment_order_state = "waiting"
elif rec.vendor_bill:
if rec.vendor_bill.state == "posted":
payment_order_state = "done"
rec.state = 'send_request_to_supplier'
else:
payment_order_state = "waiting"
rec.payment_order_state = payment_order_state
@ -1035,6 +1038,7 @@ class ServiceRequest(models.Model):
'analytic_account_id': rec.family_id.branch_family_id.branch.analytic_account_id.id,
'quantity': rec.requested_quantity,
'price_unit': rec.requested_service_amount,
'benefit_family_id': rec.family_id.id,
})
line_ids.append(invoice_line)
vendor_bill = self.env['account.move'].create({

View File

@ -13,8 +13,6 @@ class FamilyBankReportXlsx(models.AbstractModel):
@api.model
def generate_xlsx_report(self, workbook, data, objs):
sheet = workbook.add_worksheet(_('Family Bank Report'))
if self.env.user.lang != 'en_US':
sheet.right_to_left()
header_format = workbook.add_format({
'bold': True,
@ -77,12 +75,6 @@ class FamilyBankReportXlsx(models.AbstractModel):
total_amount += line['transfer_amount']
row += 1
sheet.merge_range(row + 1, 0, row + 1, 2, "Total" + " / " + "الإجمالي", bold)
sheet.write_number(row + 1, 3, total_amount, bold)
sheet.write(row + 1, 4, "", bold)
sheet.write(row + 1, 5, "SAR", bold)
sheet.set_column('A:A', 25)
sheet.set_column('B:B', 25)
sheet.set_column('C:C', 30)

View File

@ -37,6 +37,12 @@
attrs="{'invisible': [('state', '!=', 'accounting_approve')]}"
/>
<button name="action_done" type="object"
string="Done"
class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'waiting_receive')]}"
/>
<field name="state" widget="statusbar"
statusbar_visible="draft,calculated,accounting_approve,waiting_receive,done"/>
</header>

View File

@ -94,7 +94,7 @@
groups="odex_benefit.group_service_projects_department"
/>
<button name="action_accounting_approve" type="object"
<button name="action_accounting_approve" type="object" invisible="1"
string="Accounting Approve" class="oe_highlight"
confirm="Are you sure you want to approve ?"
states="accounting_approve" groups="odex_benefit.group_benefit_accounting_accept"/>
@ -208,7 +208,7 @@
<field name="service_cat"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
domain="[('id','in',available_service_cats)]" required="1"/>
<field name="is_in_kind" widget="boolean_toggle"
<field name="is_in_kind" widget="boolean_toggle" invisible="1"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<field name="service_qty"
attrs="{'invisible':[('is_in_kind','=',False)]}"/>

View File

@ -4,6 +4,7 @@ from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.tools import date_utils
class FamilyBankReportWizard(models.TransientModel):
_name = 'family.bank.report.wizard'
_description = 'Family Bank Report'
@ -18,39 +19,46 @@ class FamilyBankReportWizard(models.TransientModel):
default=lambda self: date_utils.end_of(fields.Date.today(), 'month'),
required=True
)
move_ids = fields.Many2many(comodel_name='account.move',
string="Monthly Expenses", required=True,
domain="[('state', '=', 'posted'),('date','>=', start_date),('date','<=', end_date),('line_ids.benefit_family_id', '!=', False)]"
)
payment_order_ids = fields.Many2many(comodel_name='payment.orders',
string="Payment Orders", required=True,
domain="[('state', '=', 'waiting_deposit'),('payment_order_date','>=', start_date),('payment_order_date','<=', end_date)]")
def action_print_bank_report(self):
if not self.move_ids:
raise UserError(_("Please select at least one Monthly Expense."))
lines_data = []
for move in self.move_ids:
if not self.payment_order_ids:
raise UserError(_("Please select at least one Payment Order."))
moves = self.payment_order_ids.mapped('move_id')
if not moves:
raise UserError(_("Selected Payment Orders do not reference any posted moves."))
grouped = {}
for move in moves:
for line in move.line_ids.filtered(lambda l: l.debit > 0 and l.benefit_family_id):
family = line.benefit_family_id
beneficiary_name = ''
beneficiary_id = ''
if family.is_family_member:
beneficiary_name = family.family_member_id.name
beneficiary_id = family.family_member_id.member_id_number
else:
beneficiary_name = family.acc_holder_name
beneficiary_id = family.acc_holder_id_number
lines_data.append({
'bank_name': family.bank_id.name or '',
'account_number': 'SA' + family.acc_number or '',
'beneficiary_name': beneficiary_name,
'transfer_amount': line.debit or 0.0,
'beneficiary_id': beneficiary_id,
'currency': 'SAR',
'family_code': family.code or '',
'purpose': 'Others',
})
key = family.id
if key not in grouped:
if family.is_family_member and family.family_member_id:
beneficiary_name = family.family_member_id.name or ''
beneficiary_id = getattr(family.family_member_id, 'member_id_number', '') or ''
else:
beneficiary_name = family.acc_holder_name or ''
beneficiary_id = family.acc_holder_id_number or ''
grouped[key] = {
'bank_name': (family.bank_id.name or ''),
'account_number': 'SA' + (family.acc_number or ''),
'beneficiary_name': beneficiary_name,
'beneficiary_id': beneficiary_id,
'transfer_amount': 0.0,
'currency': 'SAR',
'family_code': family.code or '',
'purpose': 'Others',
}
grouped[key]['transfer_amount'] += float(line.debit or 0.0)
lines_data = list(grouped.values())
if not lines_data:
raise UserError(_("No debit lines with family information found."))
datas = {
'start_date': self.start_date,
'end_date': self.end_date,

View File

@ -16,8 +16,8 @@
</group>
</group>
<notebook>
<page string="Family Monthly Expense">
<field name="move_ids" options="{'no_create': True}"/>
<page string="Payment Orders">
<field name="payment_order_ids" options="{'no_create': True}"/>
</page>
</notebook>
</sheet>

View File

@ -71,6 +71,7 @@
'views/takaful_payment_method.xml',
'views/product_views.xml',
'data/message_template_data.xml',
'data/server_actions.xml',
'wizards/transfer_deduction_wizard_views.xml',
'reports/transfer_deduction_report.xml',

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="server_action_unlink_sponsor_and_related" model="ir.actions.server">
<!-- <record id="server_action_unlink_sponsor_and_related" model="ir.actions.server">
<field name="name">Sponsor Unlink And Its Relations</field>
<field name="model_id" ref="odex_takaful.model_takaful_sponsor"/>
<field name="binding_model_id" ref="odex_takaful.model_takaful_sponsor"/>
@ -9,7 +9,7 @@
<field name="code">
action = records.action_unlink_sponsor_and_related()
</field>
</record>
</record> -->
<record id="action_extend_donation" model="ir.actions.server">
<field name="name">Extend Donation</field>

View File

@ -7262,7 +7262,7 @@ msgstr "اسم الكافل/المتبرع"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__direct_debit_partner_bank_id
msgid "Direct Debit Partner Bank"
msgstr "البنك المتبرع"
msgstr "بنك المتبرع"
#. module: odex_takaful
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
@ -7270,6 +7270,61 @@ msgstr "البنك المتبرع"
msgid "Add New Sponsor"
msgstr "إضافة كافل/متبرع جديد"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Choose Record Type"
msgstr "اختر نوع السجل"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Donation Type"
msgstr "نوع التبرع"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Unconditional"
msgstr "غير مشروط"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Conditional"
msgstr "مشروط"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Record Type"
msgstr "نوع السجل"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Donor Information"
msgstr "معلومات المتبرع"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Details"
msgstr "التفاصيل"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Choose donation type then enter donor information"
msgstr "اختر نوع التبرع ثم أدخل معلومات المتبرع"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Enter sponsor information then select beneficiary"
msgstr "أدخل معلومات الكافل ثم اختر المستفيد"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Select registered sponsor from the list"
msgstr "اختر كافل مسجل من القائمة"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
msgid "Saudi mobile number format"
msgstr "تنسيق رقم الجوال السعودي"
#. module: odex_takaful
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_takaful_sponsor_form
msgid "Related Donors"

View File

@ -67,6 +67,8 @@ class DonationsDetailsLines(models.Model):
benefits_count = fields.Integer(string='Benefits Count', compute='_get_benefits_count')
total_donation_amount = fields.Float(string='Total Donation Amount', compute='_get_total_donation_amount')
total_months_amount = fields.Float(string='Total Months Amount', compute='_get_total_months_amount')
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
sponsorships_computed = fields.Boolean(copy=False, readonly=True)
direct_debit = fields.Boolean(string='Direct Debit')
benefit_id_number = fields.Char("Benefit ID Number")

View File

@ -16,6 +16,8 @@ class SchedulingLine(models.Model):
scheduled_date = fields.Date(string='Scheduled Date', help='Date when the payment should be automatically processed')
amount = fields.Float()
refunded_amount = fields.Float(string='Refunded Amount')
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
status = fields.Selection([
('unpaid', 'Unpaid'),
('paid', 'Paid'),
@ -136,6 +138,7 @@ class SchedulingLine(models.Model):
dont_redirect_to_payments=True,
schedule_line_id=line.id,
is_direct_debit=True,
sponsorship_id=sponsorship.id,
sponsorship_line_ids=line.donation_detail_linked_id.ids,
from_cron=True,
force_sponsorship_line_partner_id=line.donation_detail_linked_id.sponsor_id.id,

View File

@ -12,6 +12,8 @@ class DonationsItems(models.Model):
show_donation_item = fields.Boolean(string='Show Donation Item')
fixed_value = fields.Boolean(string='Is Fixed Value?')
fixed_donation_amount = fields.Float(string='Donation Amount')
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
account_id = fields.Many2one('account.account', string="Account",domain="[('user_type_id.id','=',13)]")
product_id = fields.Many2one('product.product', string="Product", domain="[('type', '=', 'service')]")
_quantity = fields.Float(default=0, store=True)

View File

@ -43,6 +43,8 @@ class TakafulContribution(models.Model):
string='Operation Type',
)
amount = fields.Float(string="Amount")
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
note = fields.Text(string='Note/Message')
date = fields.Datetime(string="Date", default=fields.Datetime.now)
entry_id = fields.Many2one('account.move', string="Entry")

View File

@ -129,6 +129,8 @@ class GrantBenefitInvoice(models.Model):
string='Target of Beneficiaries',
)
paid_amount = fields.Float(string='Paid Amount', readonly=True)
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
partner_id = fields.Many2one('res.partner', string='From',
store=True,
related='operation_invoice_id.partner_id')
@ -332,6 +334,8 @@ class SponsorshipBenefitArrears(models.Model):
related="sponsorship_id.code", store=True)
month_amount = fields.Float(string="Month Sponsorship Amount",
related="sponsorship_id.load_amount", store=True, readonly=True)
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
arrears_month_number = fields.Integer(string="Arrears Months Number")
arrears_total = fields.Float(string="Arrears Total")
date = fields.Date('Date', readonly=True, default=fields.Date.today())

View File

@ -22,6 +22,8 @@ class MonthPayment(models.Model):
account_id = fields.Many2one('account.account', )
date = fields.Date(string="Date", default=fields.Datetime.now)
amount = fields.Float(string="Total Amount", compute='_compute_payment_total', store=True)
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
count = fields.Integer(string="Count", compute='_compute_payment_total', store=True)
user_id = fields.Many2one('res.users', string="Issued By", default=lambda self: self.env.user)
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.user.company_id)
@ -210,6 +212,8 @@ class MonthPaymentLine(models.Model):
state = fields.Selection(related="month_id.state", store=True)
code = fields.Char(related="month_id.code", store=True)
amount = fields.Float(string="Amount")
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
"""
@api.model

View File

@ -67,9 +67,9 @@ class TakafulSponsorship(models.Model):
branch_custom_id = fields.Many2one('branch.settings', string="Branch", default=lambda self: self._default_branch_custom_id(), required=True, tracking=True)
sponsorship_creation_date = fields.Datetime(string="Sponsorship Creation Date", default=fields.Datetime.now, required=True, copy=False)
sponsor_note = fields.Text(string='Sponsor Note')
sponsor_or_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor'), ('unknown', 'Unknown')], required=True)
sponsor_or_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor'), ('unknown', 'Unknown')], required=True, default='registered')
# ('not_registered', 'Not Registered'),
sponsor_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor')])
sponsor_donor_type = fields.Selection(string='Sponsor / Donor Type',selection=[('registered', 'Registered'), ('new_sponsor', 'New Sponsor')], default='registered')
sponsor_name = fields.Char(string="Sponsor Name")
sponsor_phone = fields.Char(string="Sponsor Phone", compute='_compute_sponsor_phone', store=True, readonly=False)
sponsor_title = fields.Many2one('res.partner.title',string='Sponsor Title')
@ -655,6 +655,8 @@ class TakafulSponsorship(models.Model):
compute='_check_if_has_delay', store=True)
contribution_value = fields.Float(string="Contribution Value")
load_amount = fields.Float(string="Load Amount Per Person")
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
total_contribution = fields.Float(string="Contributions Total",
compute='calculate_total_paid')
@ -680,8 +682,8 @@ class TakafulSponsorship(models.Model):
last_invoice_date = fields.Date(string='Last Invoice')
voucher_ids = fields.One2many('account.move','sponsorship_id',string='Vouchers', copy=False)
record_type = fields.Selection([
('sponsorship', 'Sponsorship'),
('donation', 'Donation'),
('sponsorship', 'Sponsorship'),
], string="Record Type", required=True, default=lambda self: self._get_default_record_type(), copy=False)
is_donations_coordinator = fields.Boolean(string="Is Donations Coordinator", compute='_compute_is_coordinator')
is_sponsorship_coordinator = fields.Boolean(string="Is Sponsorship Coordinator", compute='_compute_is_coordinator')
@ -701,7 +703,10 @@ class TakafulSponsorship(models.Model):
@api.depends('payment_ids')
def _compute_state(self):
for sponsorship in self:
if sponsorship.payment_ids and sponsorship.amount_paid >= sponsorship.total_sponsorship_amount:
if not sponsorship.payment_ids:
sponsorship.state = sponsorship.state
continue
if sponsorship.amount_paid >= sponsorship.total_sponsorship_amount:
sponsorship.state = 'paid'
vendor_bill_vals = []
@ -741,7 +746,7 @@ class TakafulSponsorship(models.Model):
line.product_uom_id = line._get_computed_uom()
bill_id.action_post()
else:
sponsorship.state = sponsorship.state
sponsorship.state = 'wait_pay'
def copy(self, default=None):
self.ensure_one()
@ -1749,6 +1754,8 @@ class RefundDetailsLines(models.TransientModel):
related='sponsorship_id.sponsor_id'
)
refund_amount = fields.Float(string='Refund Amount')
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
refund_reason = fields.Many2one(
'refund.reasons',
string='Refund Reason',
@ -1781,6 +1788,8 @@ class PaymentDetailsLines(models.Model):
donation_amount = fields.Float(string='Donation Amount')
remaining_amount = fields.Float(string='Remaining Amount')
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
donation_date = fields.Date(string='Donation Date',default=lambda self: fields.Date.today(), readonly=True)
payment_date = fields.Datetime(string='Payment Date', default=fields.Datetime.now)
note = fields.Char(string='Note')

View File

@ -45,6 +45,8 @@ class TakafulSponsorOperation(models.Model):
origin_id = fields.Integer(readonly=True)
period_code = fields.Char(string="Period Code", compute='_compute_period_filter')
amount = fields.Float(string="Amount")
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
def _compute_period_filter(self):
""" Extract period code from date """

View File

@ -29,6 +29,8 @@ class SponsorshipPayment(models.Model):
payment_month_number = fields.Integer(string="Sponsorships Number To Pay")
month_amount = fields.Float(string="Sponsorship Amount", related="sponsorship_id.contribution_value",store=True, readonly=True)
amount = fields.Float(string="Total Amount", compute="get_amount_month", store=True)
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
iban = fields.Char(string='IBAN / Account Number', tracking=True)
transfer_receipt = fields.Binary(string='Transfer Receipt')
bank_id = fields.Many2one('res.bank', string="Bank Name")

View File

@ -12,4 +12,248 @@
</xpath>
</template>
<!-- تحسينات بسيطة للتكافل -->
<template id="takaful_simple_enhancements" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<style>
/* تحسينات بسيطة فقط */
.o_form_label {
font-weight: 500;
}
.o_field_widget.o_field_monetary input {
font-weight: 600;
}
.o_field_widget.o_field_phone input {
direction: ltr;
}
/* Fix top spacing caused by h1 */
h1 {
margin-bottom: 5px !important;
margin-top: 5px !important;
}
/* Record Type Simple &amp; Clean Design */
.o_record_type_simple {
background: #f8f9fa;
padding: 8px 15px;
border-radius: 8px;
margin: 0;
text-align: center;
}
.record_type_options {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 5px;
}
.record_option {
background: white;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 15px 25px;
cursor: pointer;
transition: all 0.2s ease;
min-width: 120px;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.record_option:hover {
border-color: #007bff;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}
.record_option.selected {
border-color: #28a745;
background: #f8fff9;
box-shadow: 0 2px 8px rgba(40,167,69,0.15);
}
.record_option i {
font-size: 24px;
color: #6c757d;
}
.donation_option.selected i {
color: #28a745;
}
.sponsorship_option.selected i {
color: #007bff;
}
/* Donation Mechanism Simple Design */
.o_donation_mechanism_simple {
margin: 8px 0;
padding: 8px 15px;
background: #fff8e1;
border-radius: 6px;
border-left: 4px solid #ffc107;
text-align: center;
}
.mechanism_options {
display: flex;
justify-content: center;
gap: 15px;
margin-top: 5px;
}
.mechanism_option {
background: white;
border: 2px solid #e9ecef;
border-radius: 6px;
padding: 10px 20px;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 8px;
min-width: 120px;
justify-content: center;
}
.mechanism_option i {
width: 20px;
text-align: center;
font-size: 16px;
}
.mechanism_option span {
min-width: 90px;
display: inline-block;
text-align: center;
}
.mechanism_option:hover {
border-color: #ffc107;
background: #fffbf0;
}
.mechanism_option.selected {
border-color: #ff9800;
background: #fff3e0;
color: #e65100;
}
/* Help Messages Styling */
.alert {
margin: 8px 0;
padding: 8px 15px;
border-radius: 6px;
font-size: 14px;
}
.alert-info {
background-color: #e8f4fd;
border: 1px solid #bee5eb;
color: #0c5460;
}
.alert-primary {
background-color: #cce7ff;
border: 1px solid #b3d7ff;
color: #004085;
}
</style>
<script type="text/javascript">
odoo.define('takaful.simple_ui_enhancement', function (require) {
'use strict';
var FormController = require('web.FormController');
FormController.include({
start: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
if (self.modelName === 'takaful.sponsorship') {
self._setupSimpleUI();
}
});
},
_update: function () {
var result = this._super.apply(this, arguments);
if (this.mode === 'edit' &amp;&amp; this.modelName === 'takaful.sponsorship') {
var self = this;
setTimeout(function() {
self._setupSimpleUI();
}, 50);
}
return result;
},
_setupSimpleUI: function () {
var self = this;
// Remove old event handlers to prevent duplicates
this.$('.record_option').off('click');
this.$('.mechanism_option').off('click');
// Record Type Options - Odoo 14 Compatible Method
this.$('.record_option').on('click', function () {
var $option = $(this);
var recordType = $option.data('value');
// Update field value using Odoo 14 method
self.trigger_up('field_changed', {
dataPointID: self.handle,
changes: {record_type: recordType}
});
// Update visual selection
self.$('.record_option').removeClass('selected');
$option.addClass('selected');
});
// Donation Mechanism Options - Odoo 14 Compatible Method
this.$('.mechanism_option').on('click', function () {
var $option = $(this);
var mechanism = $option.data('value');
// Update field value using Odoo 14 method
self.trigger_up('field_changed', {
dataPointID: self.handle,
changes: {donation_mechanism: mechanism}
});
// Update visual selection
self.$('.mechanism_option').removeClass('selected');
$option.addClass('selected');
});
// Set default selection on load
setTimeout(function() {
var currentRecordType = self.model.localData[self.handle].data.record_type;
if (currentRecordType) {
self.$('.record_option[data-value="' + currentRecordType + '"]').addClass('selected');
} else {
// Default to donation as requested
self.$('.record_option[data-value="donation"]').addClass('selected');
}
var currentMechanism = self.model.localData[self.handle].data.donation_mechanism;
if (currentMechanism) {
self.$('.mechanism_option[data-value="' + currentMechanism + '"]').addClass('selected');
} else {
// Default to without_conditions (غير مشروط) as requested
self.$('.mechanism_option[data-value="without_conditions"]').addClass('selected');
}
}, 100);
}
});
});
</script>
</xpath>
</template>
</odoo>

View File

@ -66,7 +66,7 @@
<field name="direct_debit" invisible="1" />
<field name="sequence_no" />
<field name="sponsor_id" />
<field name="sponsor_phone" />
<field name="sponsor_phone" widget="phone"/>
<field name="donation_type" optional="show"/>
<field name="sponsorship_duration" optional="hide"/>
<field name="donation_mechanism" optional="hide"/>
@ -74,10 +74,11 @@
<field name="benefit_status" widget="badge"
decoration-success="benefit_status == 'benefit'"
decoration-danger="benefit_status == 'non_benefit'"/>
<field name="start_date" />
<field name="end_date" />
<field name="donation_amount" />
<field name="total_donation_amount" />
<field name="start_date" widget="date"/>
<field name="end_date" widget="date"/>
<field name="donation_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="total_donation_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="branch_custom_id" optional="hide" />
<field name="benefit_family_code" optional="hide" />
<field name="benefit_id" optional="hide" />
@ -180,19 +181,31 @@
<field name="donation_type" invisible="1"/>
<field name="donation_types"
attrs="{'invisible': [('donation_type', '!=', 'donation')], 'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="product_template_id" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
<field name="product_template_id"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}"
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
<field name="product_id" invisible="1" />
<field name="donation_mechanism" invisible="1" />
<field name="fixed_value" invisible="1" />
<field name="donation_amount" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="total_donation_amount" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="currency_id" invisible="1"/>
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="total_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
</group>
<group string="Sponsorship Information">
<field name="sponsorship_id" readonly="1" attrs="{'invisible': [('sponsorship_id', '=', False)]}" />
<field name="sponsorship_mechanism_id" readonly="1" attrs="{'invisible': [('sponsorship_mechanism_id', '=', False)]}" />
<field name="sponsor_id" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="sponsor_phone" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="branch_custom_id" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="sponsorship_id" readonly="1"
attrs="{'invisible': [('sponsorship_id', '=', False)]}" />
<field name="sponsorship_mechanism_id" readonly="1"
attrs="{'invisible': [('sponsorship_mechanism_id', '=', False)]}" />
<field name="sponsor_id"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="sponsor_phone" widget="phone"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="branch_custom_id"
attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="sponsorship_creation_date" invisible="1" />
<field name="parent_state" invisible="1" />
<field name="is_paid" invisible="1" />
@ -224,28 +237,27 @@
<field name="payment_option"
attrs="{'invisible': [('sponsorship_duration','!=','temporary')], 'required': [('sponsorship_duration','=','temporary')], 'readonly': [('parent_state', '!=', 'draft')]}"
readonly="1" force_save="1" />
<field name="payment_month_count"
attrs="{'invisible': ['&amp;', ('sponsorship_duration','!=','temporary'), ('direct_debit', '=', False)], 'required': [('sponsorship_duration','=','temporary')], 'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="start_date" string="Start Date"
<field name="start_date" string="Start Date" widget="date"
attrs="{'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)], 'required': [('sponsorship_duration', '=','temporary')], 'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="end_date" string="End Date"
<field name="end_date" string="End Date" widget="date"
attrs="{'invisible': ['&amp;', ('sponsorship_duration', '!=', 'temporary'), ('direct_debit', '=', False)], 'readonly': [('parent_state', '!=', 'draft')]}" />
</group>
<group>
<field name="donation_mechanism" invisible="1" />
<field name="fixed_value" invisible="1" />
<field name="donation_amount"
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':['|', ('fixed_value','=',True), ('parent_state', '!=', 'draft')]}"
force_save="1" required="1" />
<field name="benefits_count"
attrs="{'invisible':[('sponsorship_type','!=','group')], 'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="total_donation_amount"
<field name="total_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'invisible':[('sponsorship_type','!=','group')], 'readonly': [('parent_state', '!=', 'draft')]}" />
<field name="name" attrs="{'readonly': [('parent_state', '!=', 'draft')]}" />
</group>
</group>
<group string="Benefit Details"
attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}">
@ -303,8 +315,9 @@
<field name="sequence_no" />
<field name="beneficiary_id" />
<field name="month_year" />
<field name="amount" />
<field name="refunded_amount" />
<field name="currency_id" invisible="1"/>
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="refunded_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="status" widget="badge"
decoration-danger="status == 'unpaid'"
decoration-success="status == 'paid'"

View File

@ -31,7 +31,9 @@
<field name="direct_debit_end_date" attrs="{'invisible': [('payment_method','!=','direct_debit')]}"/>
<field name="donation_date"/>
<field name="charity_journal_id" attrs="{'invisible': [('payment_method','!=','card'),('payment_method','!=','credit_card')]}"/>
<field name="donation_amount" readonly="1" force_save="1"/>
<field name="currency_id" invisible="1"/>
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
<field name="sponsorship_id" invisible="1" readonly="1" force_save="1"/>
<field name="account_payment_method" attrs="{'invisible': [('payment_method','!=','card'),('payment_method','!=','credit_card')]}"/>
<field name="note"/>

View File

@ -32,17 +32,11 @@
<field name="has_bank_account" attrs="{'invisible': [('payment_method', '=', 'cash')]}" style="margin-bottom:10px;"/>
<label for="month_amount"/>
<div>
<field name="month_amount" force_save="1" class="oe_inline" style="margin-right:50px; margin-bottom:20px;"/>
<span class="oe_inline text-muted"> Riyal</span>
</div>
<label for="amount" />
<div>
<field name="amount" readonly="1" class="oe_inline" style="margin-right:50px;"/>
<span class="oe_inline text-muted"> Riyal</span>
</div>
<field name="currency_id" invisible="1"/>
<field name="month_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" force_save="1"/>
<field name="amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1"/>
</group>
<group name="group_right" attrs="{'invisible': [('payment_method', '=', 'cash')]}">
@ -73,8 +67,9 @@
<tree string="Payments List" decoration-danger="state=='financial'" decoration-success="state=='paid'">
<field name="sponsor_id"/>
<field name="code"/>
<field name="amount" sum="Total Payments" widget="monetary"/>
<field name="date"/>
<field name="amount" sum="Total Payments" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="date" widget="date"/>
<field name="state"/>
</tree>
</field>

View File

@ -11,7 +11,10 @@
<field name="name" required="1"/>
<field name="donation_type" required="1"/>
<field name="fixed_value"/>
<field name="fixed_donation_amount" attrs="{'invisible': [('fixed_value', '=', False)],'required': [('fixed_value', '=', True)]}"/>
<field name="currency_id" invisible="1"/>
<field name="fixed_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'invisible': [('fixed_value', '=', False)],'required': [('fixed_value', '=', True)]}"/>
</group>
<group>
<field name="branch_custom_id" required="1"/>

View File

@ -30,7 +30,9 @@
<field name="benefit_id" attrs="{'invisible': [('benefit_ids','=', False)]}"/>
<field name="benefit_ids" attrs="{'invisible': [('benefit_id','!=', False)]}"/>
<field name="operation_type"/>
<field name="amount"/>
<field name="currency_id" invisible="1"/>
<field name="amount" widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="note"/>
<field name="date"/>
<field name="entry_id" invisible='1'/>
@ -49,8 +51,9 @@
<field name="name"/>
<field name="sponsor_id"/>
<field name="operation_type"/>
<field name="amount"/>
<field name="date"/>
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="date" widget="datetime"/>
</tree>
</field>
</record>
@ -64,8 +67,8 @@
<field name="name"/>
<field name="sponsor_id"/>
<field name="operation_type"/>
<field name="amount"/>
<field name="date"/>
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="date" widget="datetime"/>
</search>
</field>
</record>

View File

@ -69,8 +69,10 @@
<field name="due_date" />
<field name="journal_id" readonly="1" />
<field name="paid_amount" readonly="1" />
<field name="payment_date" readonly="1" />
<field name="currency_id" invisible="1"/>
<field name="paid_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="payment_date" widget="date" readonly="1" />
<field name="benefit_target" readonly="1" />
<field name="note" readonly="1" />
@ -106,9 +108,10 @@
<field name="benefit_target" />
<field name="benefit_ids" widget="many2many_tags" />
<field name="partner_id" />
<field name="due_date" />
<field name="payment_date" />
<field name="paid_amount" />
<field name="due_date" widget="date"/>
<field name="payment_date" widget="date"/>
<field name="paid_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="is_recorded" />
</tree>
</field>
@ -160,16 +163,21 @@
<field name="benefit_id" required="1" />
<field name="benefit_type" readonly="1" />
<field name="month_amount" readonly="1" />
<field name="currency_id" invisible="1"/>
<field name="month_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="arrears_month_number" readonly="1" />
<field name="arrears_total" readonly="1" />
<field name="date" readonly="1" />
<field name="arrears_total" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="date" widget="date" readonly="1" />
</group>
<group string="Payment Information">
<field name="arrears_amount" readonly="1" />
<field name="paid_amount" readonly="1" />
<field name="arrears_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="paid_amount" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="invoice_ids" widget="one2many" />
</group>
</sheet>
@ -188,11 +196,12 @@
<field name="sponsor_id" />
<field name="benefit_id" />
<field name="benefit_type" />
<field name="date" />
<field name="date" widget="date"/>
<field name="arrears_month_number" />
<field name="arrears_total" />
<field name="arrears_amount" />
<field name="paid_amount" />
<field name="arrears_total" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="arrears_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="paid_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
</tree>
</field>
</record>
@ -206,11 +215,11 @@
<field name="sponsor_id" />
<field name="benefit_id" />
<field name="benefit_type" />
<field name="date" />
<field name="date" widget="date"/>
<field name="arrears_month_number" />
<field name="arrears_total" />
<field name="arrears_amount" />
<field name="paid_amount" />
<field name="arrears_total" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="arrears_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="paid_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</search>
</field>
</record>

View File

@ -49,10 +49,12 @@
<group col="4" colspan="2">
<field name="date" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>
<field name="date" widget="date" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>
<field name="user_id" readonly="1" force_save="1"/>
<field name="entry_id" readonly="1" force_save="1"/>
<field name="amount"
<field name="currency_id" invisible="1"/>
<field name="amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':[('state','!=','draft')],'required':True}"/>
</group>

View File

@ -86,67 +86,142 @@
<h1>
<field name="code" nolabel="1"/>
</h1>
<!-- Record Type Selection - Simple & Clean Design -->
<div class="o_record_type_simple">
<div class="record_type_options">
<div class="record_option donation_option" data-value="donation">
<i class="fa fa-heart"></i>
<span>تبرع</span>
</div>
<div class="record_option sponsorship_option" data-value="sponsorship">
<i class="fa fa-users"></i>
<span>كفالة</span>
</div>
</div>
<!-- Hidden field for actual value -->
<field name="record_type" readonly="0" nolabel="1" invisible="1"
groups="!odex_takaful.branch_manager_group,!odex_takaful.sponsorship_system_manager_group,odex_takaful.donation_officer_group,odex_takaful.sponsorship_officer_group"/>
<field name="record_type" nolabel="1" invisible="1"
groups="odex_takaful.branch_manager_group,odex_takaful.sponsorship_system_manager_group"
attrs="{'readonly': [('state','!=','draft')]}"/>
</div>
<!-- Donation Type Selection - Only for Donations -->
<div class="o_donation_mechanism_simple"
attrs="{'invisible': [('record_type','!=','donation')]}">
<div class="mechanism_options">
<div class="mechanism_option without_conditions" data-value="without_conditions">
<i class="fa fa-check-circle"></i>
<span>غير مشروط</span>
</div>
<div class="mechanism_option with_conditions" data-value="with_conditions">
<i class="fa fa-list-alt"></i>
<span>مشروط</span>
</div>
</div>
<!-- Hidden field for actual value -->
<field name="donation_mechanism" invisible="1" nolabel="1"
attrs="{'required': [('record_type','=','donation')], 'readonly': [('state','!=','draft')]}"/>
</div>
<!-- Help Messages Section -->
<div class="alert alert-info text-center"
attrs="{'invisible': [('record_type','!=','donation')]}">
<i class="fa fa-heart text-success"/> اختر نوع التبرع ثم أدخل بيانات المتبرع
</div>
<div class="alert alert-primary text-center"
attrs="{'invisible': [('record_type','!=','sponsorship')]}">
<i class="fa fa-users text-primary"/> أدخل بيانات الكافل ثم اختر المستفيد
</div>
<group name="group_top">
<group name="group_left" string="Donor Information">
<field name="record_type" readonly="0"
groups="!odex_takaful.branch_manager_group,!odex_takaful.sponsorship_system_manager_group,odex_takaful.donation_officer_group,odex_takaful.sponsorship_officer_group"/>
<field name="record_type"
groups="odex_takaful.branch_manager_group,odex_takaful.sponsorship_system_manager_group"
attrs="{'readonly': [('state','!=','draft')]}"/>
<field name="donation_mechanism"
attrs="{'invisible': [('record_type','!=','donation')], 'required': [('record_type','=','donation')], 'readonly': [('state','!=','draft')]}"/>
<field name="manager_id" invisible="1"/>
<field name="is_donations_coordinator" invisible="1"/>
<field name="is_sponsorship_coordinator" invisible="1"/>
<field name="registered_type" invisible="1" attrs="{'readonly': [('state','!=','draft')]}"/>
<label string="Sponsor / Donor Type" for="sponsor_or_donor_type"/>
<div class="o_row">
<field name="sponsor_or_donor_type"
attrs="{'invisible': [('record_type','!=','donation')],'readonly': [('state','!=','draft')]}"/>
attrs="{'invisible': [('record_type','!=','donation')], 'required': [('record_type','=','donation')], 'readonly': [('state','!=','draft')]}"/>
<field name="sponsor_donor_type"
attrs="{'invisible': [('record_type','!=','sponsorship')], 'readonly': [('state','!=','draft')]}"/>
attrs="{'invisible': [('record_type','!=','sponsorship')], 'required': [('record_type','=','sponsorship')], 'readonly': [('state','!=','draft')]}"/>
</div>
<label string="Sponsor Name" for="sponsor_id"/>
<div class="o_row">
<field name="sponsor_id" nolabel="1"
context="{'form_view_ref': 'odex_takaful.view_takaful_sponsor_form'}"
attrs="{
'required': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','registered'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','registered')
],
'readonly': ['|',
('state','!=','draft'),
'|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','new_sponsor'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','new_sponsor')
]
}"
force_save="1"
options="{'no_create': True, 'no_create_edit': True}"/>
<button name="create_new_sponsor" type="object"
string="Create New Sponsor" class="btn-success"
string="إنشاء مشترك"
class="btn-primary oe_highlight"
icon="fa-plus"
attrs="{
'invisible': [
'|','|',('sponsor_id','!=',False),
'&amp;', ('record_type', '!=', 'donation'), ('sponsor_donor_type', '!=', 'new_sponsor'),
'&amp;', ('record_type', '!=', 'sponsorship'), ('sponsor_or_donor_type', '!=', 'new_sponsor')
'invisible': ['|', '|',
('sponsor_id','!=',False),
'&amp;', ('record_type', '=', 'donation'), ('sponsor_or_donor_type', '!=', 'new_sponsor'),
'&amp;', ('record_type', '=', 'sponsorship'), ('sponsor_donor_type', '!=', 'new_sponsor')
]
}"/>
</div>
<field name="registered_type"
invisible="1"
attrs="{'readonly': [('state','!=','draft')]}"/>
<!-- attrs="{'invisible': [('sponsor_or_donor_type','!=','registered')], 'required': [('sponsor_or_donor_type','=','registered')],'readonly': [('state','!=','draft')]}"/>-->
<field name="sponsor_id"
context="{'form_view_ref': 'odex_takaful.view_takaful_sponsor_form'}"
attrs="{'invisible': [('sponsor_id','=',False), ('sponsor_or_donor_type','!=','registered')],
'required':[('sponsor_or_donor_type','=','registered')],
'readonly':[('state','!=','draft')]}"
force_save="1" options="{'no_create': True, 'no_create_edit': True}"/>
<field name="preferred_communication"
attrs="{'invisible': [('sponsor_id','=',False), ('sponsor_or_donor_type','!=','registered')]}"
force_save="1" options="{'no_create': True, 'no_create_edit': True}"/>
<!-- <field name="sponsor_phone"-->
<!-- attrs="{'invisible': [('sponsor_or_donor_type','=', False)], 'readonly': [('sponsor_id', '!=', False)]}"/>-->
<field name="sponsor_phone"
attrs="{'invisible': [('sponsor_or_donor_type','=', False)], 'readonly': [('sponsor_or_donor_type', '!=', 'unknown')]}"/>
<field name="sponsor_phone" string="رقم الجوال" widget="phone"
attrs="{
'readonly': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','!=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','!=','unknown')
]
}"
placeholder="05xxxxxxxx"/>
<field name="preferred_communication" string="طريقة التواصل المفضلة"
attrs="{
'invisible': ['|',
'&amp;', ('record_type','=','donation'), ('sponsor_or_donor_type','=','unknown'),
'&amp;', ('record_type','=','sponsorship'), ('sponsor_donor_type','=','unknown')
],
'readonly': [True]
}"
force_save="1"
options="{'no_create': True, 'no_create_edit': True}"/>
</group>
<group name="group_right" string="Basic Information">
<field name="is_widow_orphan" invisible="1"/>
<field name="cancel_refund" invisible="1"/>
<field name="donate_for_another_person" widget="boolean_toggle"/>
<field name="has_delay" invisible="1"/>
<field name="members_domain_ids" invisible="1"/>
</group>
<group name="group_right" string="Basic Information">
<field name="donate_for_another_person" widget="boolean_toggle"/>
<field name="sponsorship_creation_date" readonly="1"/>
<field name="create_uid" string="Sponsorship Creator" readonly="1"/>
<!-- <field name="branch_custom_id" groups="!odex_takaful.sponsorship_system_manager_group" readonly="1" />-->
<field name="branch_custom_id" groups="!odex_takaful.sponsorship_system_manager_group"
readonly="0"/>
<field name="branch_custom_id"
groups="odex_takaful.sponsorship_system_manager_group"
attrs="{'readonly': [('state','!=','draft')]}"/>
<field name="marketer_id" attrs="{'readonly': [('state','!=','draft')]}"
context="{'default_domain_force_all': True}"/>
</group>
@ -161,7 +236,7 @@
attrs="{'invisible': [('is_gift', '!=', 'yes')]}">
<field name="gifter_id" readonly="1"/>
<field name="gifter_name" readonly="1"/>
<field name="gifter_mobile" readonly="1"/>
<field name="gifter_mobile" widget="phone" readonly="1"/>
<field name="gifter_message" readonly="1"/>
</group>
@ -177,7 +252,7 @@
<field name="another_sponsors">
<tree editable="bottom">
<field name="sponsor_name"/>
<field name="sponsor_phone"/>
<field name="sponsor_phone" widget="phone"/>
<field name="sponsor_id_number"/>
<field name="receive_messages" widget="boolean_toggle"/>
<field name="note"/>
@ -208,7 +283,7 @@
<field name="family_domain_ids" invisible="1"/>
<field name="fixed_value" invisible="1"/>
<field name="sequence" widget="handle"/>
<field name="sequence_no" readonly="1"/>
<field name="sequence_no" readonly="1" optional="hide"/>
<field name="sponsorship_scheduling_line_ids" invisible="1"/>
<field name="show_extend_button" invisible="1"/>
<field name="donation_type"
@ -248,16 +323,21 @@
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')]}"/>
<field name="payment_month_count" optional="hide"
attrs="{'invisible': [('direct_debit', '=', False)]}"/>
<field name="start_date" string="From" optional="hide"
<field name="start_date" string="From" optional="hide" widget="date"
attrs="{'invisible': [('direct_debit', '=', False)],'readonly': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]} "/>
<field name="end_date" string="To" optional="hide"
<field name="end_date" string="To" optional="hide" widget="date"
attrs="{'invisible': [('direct_debit', '=', False)]}"
readonly="1"/>
<field name="currency_id" invisible="1"/>
<field name="donation_qty" force_save="1"/>
<field name="donation_amount" attrs="{'readonly':[('fixed_value','=',True)]}"
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':[('fixed_value','=',True)]}"
force_save="1"
required="1"/>
<field name="total_donation_amount" readonly="1" force_save="1"/>
<field name="total_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
readonly="1" force_save="1"/>
<button name="action_view_scheduling_lines"
string="View Scheduling Lines"
type="object"
@ -281,8 +361,9 @@
<field name="donations_details_lines_mechanism_ids"
context="{'default_active_id': id, 'default_donation_mechanism': 'with_conditions','default_start_date': sponsorship_creation_date, 'default_sponsor_id': sponsor_id, }"
widget="section_and_note_one2many"
attrs="{'invisible': [('donation_mechanism', '=', 'without_conditions')], 'readonly': [('state','!=','draft')]}">
<tree class="fix_overflow">
<tree>
<field name="sponsorships_computed" invisible="1"/>
<field name="sponsorship_scheduling_line_ids" invisible="1"/>
<field name="show_extend_button" invisible="1"/>
@ -293,7 +374,7 @@
<field name="state" invisible="1"/>
<field name="is_paid" invisible="1"/>
<field name="direct_debit" invisible="1"/>
<field name="sequence_no" readonly="1"/>
<field name="sequence_no" readonly="1" optional="hide"/>
<field name="donation_type"
invisible="1"/>
<!-- attrs="{'column_invisible': [('parent.record_type', '=', 'donation')],'required': ['|',('parent.record_type', '=', 'donation'),('display_type', '=', False)]}"/>-->
@ -338,17 +419,22 @@
<field name="payment_month_count"
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')],'invisible': [('direct_debit', '=', False)]}"
/>
<field name="start_date"
<field name="start_date" widget="date"
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')],'invisible': [('payment_option', '!=', 'month')],'readonly': [('direct_debit', '=', False)]}"
string="Start Date"/>
<field name="end_date"
<field name="end_date" widget="date"
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')],'invisible': [('payment_option', '!=', 'month')]}"
string="End Date"/>
<field name="currency_id" invisible="1"/>
<field name="donation_qty" invisible="1" force_save="1"/>
<field name="record_type" invisible="1"/>
<field name="donation_amount" force_save="1"
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
force_save="1"
attrs="{'readonly': [('record_type','=','sponsorship')]}"/>
<field name="total_donation_amount" force_save="1"/>
<field name="total_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
force_save="1"/>
<field name="donation_mechanism"
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions')]}"/>
@ -452,20 +538,24 @@
<field name="debit_payment_attachment_file_name" invisible="1"/>
</group>
<group>
<field name="start_date" string="Start Date"
<field name="start_date" string="Start Date" widget="date"
attrs="{'invisible': [('payment_month_count_visibility','!=', True)], 'required': [('direct_debit', '=', True)], 'readonly': [('direct_debit', '=', False)],}"/>
<field name="end_date" string="End Date" readonly="1"
<field name="end_date" string="End Date" widget="date" readonly="1"
attrs="{'invisible': [('payment_month_count_visibility','!=', True)]}"/>
<field name="donation_mechanism" invisible="1" force_save="1"/>
<field name="fixed_value" invisible="1"/>
<field name="donation_qty" force_save="1" invisible="1"/>
<field name="donation_amount"
<field name="donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':[('fixed_value','=',True)]}"
force_save="1" required="1"/>
<field name="total_months_amount" attrs="{'invisible':[('payment_month_count_visibility','=', False)]}"/>
<field name="total_months_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'invisible':[('payment_month_count_visibility','=', False)]}"/>
<field name="benefits_count"
attrs="{'invisible':['|', ('sponsorship_type','!=','group'), ('record_type','!=','sponsorship')]}"/>
<field name="total_donation_amount"
<field name="total_donation_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'invisible':['|', ('sponsorship_type','!=','group'), ('record_type','!=','sponsorship')]}"
force_save="1"/>
</group>
@ -549,7 +639,9 @@
<group class="oe_subtotal_footer oe_right" colspan="2"
name="donation_total">
<field name="total_sponsorship_amount" string="Total Amount"/>
<field name="currency_id" invisible="1"/>
<field name="total_sponsorship_amount" string="Total Amount" widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="donations_count"/>
</group>
<button name="donation_catelog" type="object" string="Donation Catalog"
@ -577,7 +669,8 @@
<field name="refund_reason"/>
<field name="payment_method_id"/>
<field name="sponsor_id"/>
<field name="refund_amount"/>
<field name="refund_amount" widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="journal_id"/>
<field name="attachment_ids"
widget="many2many_attachment_preview"/>
@ -618,7 +711,8 @@
<field name="registered_type"/>
<field name="sponsor_id"/>
<field name="sponsor_name" string="Unregistered Sponsor Name" optional="show"/>
<field name="total_sponsorship_amount"/>
<field name="total_sponsorship_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="state" widget="badge"
decoration-muted="state == 'draft'"
decoration-warning="state in ['confirmed', 'wait_pay', 'approve_refund']"
@ -629,9 +723,9 @@
<field name="sponsorship_duration"/>
<field name="sponsorship_type"/>
<field name="benefit_type"/>
<field name="contribution_value"/>
<field name="end_date"/>
<field name="overdue_amount"/> -->
<field name="contribution_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="end_date" widget="date"/>
<field name="overdue_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/> -->
</tree>
</field>
</record>
@ -650,13 +744,14 @@
<search string="Takaful SponsorShip Search">
<field name="code"/>
<field name="create_uid"/>
<field name="sponsorship_creation_date"/>
<field name="sponsorship_creation_date" widget="datetime"/>
<field name="record_type"/>
<field name="branch_custom_id"/>
<field name="sponsor_or_donor_type"/>
<field name="registered_type"/>
<field name="sponsor_id"/>
<field name="total_sponsorship_amount"/>
<field name="total_sponsorship_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="state"/>
<separator/>
<!-- State Filters -->

View File

@ -20,9 +20,10 @@
<field name="month" invisible="1" />
<field name="period_code" invisible="1" />
<field name="amount" readonly="1" />
<field name="date" invisible="1" />
<field name="operation_on" readonly="1" />
<field name="currency_id" invisible="1"/>
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}" readonly="1" />
<field name="date" widget="date" invisible="1" />
<field name="operation_on" widget="datetime" readonly="1" />
</group>
</sheet>
</form>
@ -39,9 +40,10 @@
<field name="operation_type" />
<field name="sponsor_id" />
<field name="benefit_type" />
<field name="amount" />
<field name="date" />
<field name="operation_on" />
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id" invisible="1"/>
<field name="date" widget="date"/>
<field name="operation_on" widget="datetime"/>
</tree>
</field>
</record>
@ -56,8 +58,8 @@
<field name="operation_type" />
<field name="sponsor_id" />
<field name="benefit_type" />
<field name="amount" />
<field name="date" />
<field name="amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="date" widget="date"/>
</search>
</field>
</record>

View File

@ -81,11 +81,11 @@
<group attrs="{'invisible': [('company_type', '!=', 'person')]}">
<div class="o_row">
<field placeholder="Title" name="title" class="oe_inline" nolabel="1"
<field placeholder="اللقب" name="title" class="oe_inline" nolabel="1" style="width: 20%;"
domain="[('position', 'in', ['prefix','both'])]"
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
<field placeholder="Name" name="first_name" class="oe_inline" nolabel="1"/>
<field placeholder="Suffix Title" name="suffix_title_id" class="oe_inline" nolabel="1"
<field placeholder="الاسم" name="first_name" class="oe_inline" nolabel="1" style="width: 60%;"/>
<field placeholder="العبارة الختامية" name="suffix_title_id" class="oe_inline" nolabel="1" style="width: 20%;"
domain="[('position', 'in', ['suffix','both'])]"
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}"/>
</div>
@ -93,8 +93,8 @@
<group name="group_top">
<group name="group_left">
<field name="mobile" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="id_number" attrs="{'invisible': [('company_type', '!=', 'person')]}"/>
<field name="mobile" string="رقم الجوال" widget="phone" placeholder="05xxxxxxxx" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="preferred_communication" string="طريقة التواصل المفضلة" required="1"/>
<field name="gender" attrs="{'required': [('company_type', '=', 'person')],'invisible': [('company_type', '!=', 'person')]}"/>
<field name="street" attrs="{'invisible': [('company_type', '=', 'person')]}"/>
<field name="zip" attrs="{'invisible': [('company_type', '=', 'person')]}"/>
@ -107,7 +107,7 @@
<field name="city_id"/>
<field name="branch_custom_id"/>
<field name="district_id" invisible="1"/>
<field name="preferred_communication" required="1"/>
<field name="id_number" attrs="{'invisible': [('company_type', '!=', 'person')]}"/>
<!-- <field name="journal_id"/> -->
<!-- <label for="account_number" string="Bank Account"/>
<div class="o_address_format">

View File

@ -18,8 +18,6 @@ class DonationExtensionWizard(models.TransientModel):
default=lambda self: self._compute_line_ids(),
)
direct_debit = fields.Boolean(string='Direct Debit', required=True)
months = fields.Integer(
string='Extension Months',
required=True,
@ -48,10 +46,6 @@ class DonationExtensionWizard(models.TransientModel):
for rec in self:
if rec.months <= 0:
raise ValidationError(_("Extension months must be greater than 0."))
@api.onchange('direct_debit')
def _onchange_direct_debit(self):
self.line_ids.direct_debit = self.direct_debit
def action_extend(self):
"""
@ -106,6 +100,11 @@ class DonationExtensionWizardLine(models.TransientModel):
_name = 'donation.extension.wizard.line'
_description = "Donation Extension Wizard Line"
@api.model
def _default_journal_id(self):
journal_id = self.env.company.sponsorship_direct_debit_journal_id.id
return journal_id if journal_id else False
wizard_id = fields.Many2one('donation.extension.wizard', string='Wizard', required=True)
donation_line_id = fields.Many2one('donations.details.lines', string='Donation Detail', required=True, readonly=True)
donation_qty = fields.Float(compute='_compute_donation_qty', store=True)
@ -125,6 +124,8 @@ class DonationExtensionWizardLine(models.TransientModel):
readonly=True,
help='Total extension amount (amount × months)'
)
currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
current_end_date = fields.Date(
string='Current End Date',
@ -136,6 +137,10 @@ class DonationExtensionWizardLine(models.TransientModel):
compute='_compute_new_end_date',
readonly=True
)
direct_debit_partner_bank_id = fields.Many2one("res.partner.bank", string="Direct Debit Partner Bank", domain="[('partner_id', '=', partner_id)]")
debit_payment_file_attachment = fields.Binary(string='Debit Payment Attachment', attachment=True)
debit_payment_attachment_file_name = fields.Char('Debit Payment File Name', required=False)
journal_id = fields.Many2one('account.journal', string="Journal",domain="[('type','=','bank')]", default=_default_journal_id)
# related
record_type = fields.Selection(related='donation_line_id.record_type')
@ -146,6 +151,7 @@ class DonationExtensionWizardLine(models.TransientModel):
fixed_value = fields.Boolean(related='donation_line_id.fixed_value')
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')
@api.depends('benefits_count', 'donation_amount', 'months', 'donation_qty', 'record_type', 'sponsorship_type')
def _compute_total_donation_amount(self):
@ -187,12 +193,20 @@ class DonationExtensionWizardLine(models.TransientModel):
old_end_date = self.current_end_date
# Update end date
self.donation_line_id.write({
donation_line_new_vals = {
'end_date': new_end_date,
'donation_amount': self.total_months_amount,
'payment_month_count': self.donation_line_id.payment_month_count + self.months,
# 'state': 'extended',
})
}
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)
benefit_ids = self.donation_line_id.benefit_ids | self.donation_line_id.benefit_id
benefit_ids.write({
@ -218,6 +232,7 @@ class DonationExtensionWizardLine(models.TransientModel):
'invoice_id': invoice_id.id if invoice_id else False,
'old_direct_debit': self.donation_line_id.direct_debit,
'new_direct_debit': self.direct_debit,
})
if not self.direct_debit:

View File

@ -10,14 +10,12 @@
<group>
<group string="Extension Details">
<field name="months"/>
<field name="direct_debit"/>
</group>
</group>
<notebook>
<page string="Lines">
<field name="line_ids" nolabel="1">
<tree create="0" editable="bottom">
<tree create="0">
<field name="wizard_id" invisible="1" force_save="1"/>
<field name="months" invisible="1" force_save="1"/>
<field name="record_type" invisible="1" force_save="1"/>
@ -27,14 +25,56 @@
<field name="donation_mechanism" invisible="1" force_save="1"/>
<field name="fixed_value" invisible="1" force_save="1"/>
<field name="donation_line_id" force_save="1"/>
<field name="current_end_date" force_save="1"/>
<field name="new_end_date" force_save="1"/>
<field name="current_end_date" widget="date" force_save="1"/>
<field name="new_end_date" widget="date" force_save="1"/>
<field name="direct_debit" force_save="1"/>
<field name="donation_amount" string="Amount" attrs="{'readonly':[('fixed_value','=',True)]}" />
<field name="currency_id" invisible="1"/>
<field name="donation_amount" string="Amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':[('fixed_value','=',True)]}" />
<field name="donation_qty" string="Qty" attrs="{'invisible':[('donation_mechanism','!=','without_conditions')]}"/>
<field name="total_months_amount" string="Months Amount" force_save="1"/>
<field name="total_donation_amount" string="Total Amount" force_save="1"/>
<field name="total_months_amount" string="Months Amount" widget="monetary"
options="{'currency_field': 'currency_id'}" force_save="1"/>
<field name="total_donation_amount" string="Total Amount" widget="monetary"
options="{'currency_field': 'currency_id'}" force_save="1"/>
</tree>
<form>
<field name="wizard_id" invisible="1" force_save="1"/>
<field name="months" invisible="1" force_save="1"/>
<field name="record_type" invisible="1" force_save="1"/>
<field name="sponsorship_type" invisible="1" force_save="1"/>
<field name="benefits_count" invisible="1" force_save="1"/>
<field name="sponsorship_id" invisible="1" force_save="1"/>
<field name="donation_mechanism" invisible="1" force_save="1"/>
<field name="fixed_value" invisible="1" force_save="1"/>
<field name="partner_id" invisible="1" force_save="1"/>
<field name="debit_payment_attachment_file_name" invisible="1"/>
<group>
<group>
<field name="donation_line_id" force_save="1"/>
<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="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)]}"/>
<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"
attrs="{'required': [('direct_debit', '=', True)], 'invisible': [('direct_debit', '=', False)]}"/>
</group>
<group>
<field name="donation_amount" string="Amount" widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly':[('fixed_value','=',True)]}" />
<field name="donation_qty" string="Qty" attrs="{'invisible':[('donation_mechanism','!=','without_conditions')]}"/>
<field name="total_months_amount" string="Months Amount" widget="monetary"
options="{'currency_field': 'currency_id'}" force_save="1"/>
<field name="total_donation_amount" string="Total Amount" widget="monetary"
options="{'currency_field': 'currency_id'}" force_save="1"/>
</group>
</group>
</form>
</field>
</page>
</notebook>