Merge branch 'dev_odex25_ensan' into kch_dev_odex25_ensan
This commit is contained in:
commit
1eafa5959a
|
|
@ -2016,9 +2016,6 @@ msgstr "بيانات المستفيدين"
|
|||
msgid "Beneficiaries Management"
|
||||
msgstr "فئات المستفيدين"
|
||||
|
||||
|
||||
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:res.groups,name:odex_benefit.group_benefit_manager
|
||||
msgid "Beneficiaries Manager"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,14 @@
|
|||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- record <record id="translation_benefit_ar" model="ir.translation">-->
|
||||
<!-- <field name="name">ir.module.category,name</field>-->
|
||||
<!-- <field name="lang">ar_001</field>-->
|
||||
<!-- <field name="type">model</field>-->
|
||||
<!-- <field name="res_id" eval="ref('module_category_benefit')"/>-->
|
||||
<!-- <field name="src">Beneficiaries Management</field>-->
|
||||
<!-- <field name="value">فئات المستفيدين</field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record id="group_benefit_user" model="res.groups">-->
|
||||
<!-- <field name="name">Beneficiaries User</field>-->
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
'reports/transfer_deduction_report.xml',
|
||||
'reports/transfer_deduction_report_templates.xml',
|
||||
],
|
||||
'images': ['static/description/icon5.png'],
|
||||
# 'installable': True,
|
||||
# 'application': True,
|
||||
# 'auto_install': False,
|
||||
|
|
|
|||
|
|
@ -10,5 +10,13 @@
|
|||
action = records.action_unlink_sponsor_and_related()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_extend_donation" model="ir.actions.server">
|
||||
<field name="name">Extend Donation</field>
|
||||
<field name="model_id" ref="odex_takaful.model_donations_details_lines"/>
|
||||
<field name="binding_model_id" ref="odex_takaful.model_donations_details_lines"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = records.action_extend_sponsorship()</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -3226,7 +3226,7 @@ msgstr "عمليات الكفالة"
|
|||
#: model:ir.ui.menu,name:odex_takaful.kafalat_main_menu
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_takaful_sponsor_form
|
||||
msgid "Kafalat"
|
||||
msgstr "الكفالات ونقاط البيع"
|
||||
msgstr "كفالات و نقاط بيع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model,name:odex_takaful.model_takaful_wizard_report_kafalat_cancel
|
||||
|
|
@ -3258,7 +3258,7 @@ msgstr "نافذة معالج تقرير مدفوعات الكفالات"
|
|||
#. module: odex_takaful
|
||||
#: model:ir.ui.menu,name:odex_takaful.takaful_kufula_app_top_menu
|
||||
msgid "Kafalat System"
|
||||
msgstr "الكفالات ونقاط البيع"
|
||||
msgstr "كفالة و نقاط بيع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.ui.menu,name:odex_takaful.kafileen_main_menu
|
||||
|
|
@ -7055,6 +7055,11 @@ msgstr ""
|
|||
msgid "report.odex_takaful.benefit_month_payment_report_pdf"
|
||||
msgstr ""
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_donations_details_lines__journal_id
|
||||
msgid "Journal"
|
||||
msgstr "بنك الجمعية"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model,name:odex_takaful.model_report_odex_takaful_benefit_month_payment_report_xlsx
|
||||
msgid "report.odex_takaful.benefit_month_payment_report_xlsx"
|
||||
|
|
@ -7243,7 +7248,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
|
||||
|
|
@ -7254,4 +7259,54 @@ msgstr "إضافة كافل/متبرع جديد"
|
|||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_takaful_sponsor_form
|
||||
msgid "Related Donors"
|
||||
msgstr "كافل/متبرع مرتبط"
|
||||
msgstr "كافل/متبرع مرتبط"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_family_member__kafala_status
|
||||
msgid "Kafala Status"
|
||||
msgstr "حالة الكفالة"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__family_member__kafala_status__have_kafala
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.family_member_search_inherit
|
||||
msgid "Have Kafala"
|
||||
msgstr "مكفول"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__family_member__kafala_status__have_not_kafala
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.family_member_search_inherit
|
||||
msgid "Have not Kafala"
|
||||
msgstr "غير مكفول"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: code:addons/odex_takaful/models/takaful_sponorship_model.py:0
|
||||
#, python-format
|
||||
msgid "Please Check The Amount in donation Line!"
|
||||
msgstr "مبلغ التبرع صفر الرجاء ادخال قيمة لمبلغ التبرع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.product_product_view_kanban
|
||||
msgid "<i class=\"fa fa-minus center\" title=\"Decrease\"/>"
|
||||
msgstr "<i class=\"fa fa-minus center\" title=\"أنقص\"/>"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.product_product_view_kanban
|
||||
msgid "<i class=\"fa fa-plus\" title=\"Increase\"/>"
|
||||
msgstr "<i class=\"fa fa-plus\" title=\"زد\"/>"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.product_template_view_kanban_odex_takaful
|
||||
msgid ""
|
||||
"<i class=\"fa fa-shopping-cart\"/>\n"
|
||||
" <span>Add</span>"
|
||||
msgstr ""
|
||||
"<i class=\"fa fa-shopping-cart\"/>\n"
|
||||
" <span>إضافة</span>"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.family_member_form_inherit_donation_button
|
||||
msgid "Kafala Information"
|
||||
msgstr "بيانات الكفالة"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,22 @@ from collections import defaultdict
|
|||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
takaful_sponsorship_id = fields.Many2one('takaful.sponsorship')
|
||||
takaful_sponsorship_id = fields.Many2one('takaful.sponsorship', compute='_compute_takaful_sponsorship_id', store=True)
|
||||
is_refund_sponsorship = fields.Boolean(string='Is Refund Sponsorship', default=False)
|
||||
sponsorship_scheduling_line = fields.Many2one('sponsorship.scheduling.line')
|
||||
payment_details_line = fields.Many2one('payment.details.lines')
|
||||
sponsorship_id = fields.Many2one('takaful.sponsorship', string='Sponsorship', readonly=True, )
|
||||
payment_id = fields.Many2one('account.payment', string='Payment', copy=False)
|
||||
|
||||
@api.depends('state')
|
||||
def _compute_takaful_sponsorship_id(self):
|
||||
for move in self:
|
||||
if not move.takaful_sponsorship_id:
|
||||
partials = move.line_ids.matched_debit_ids | move.line_ids.matched_credit_ids
|
||||
takaful_sponsorship_ids = (partials.debit_move_id.move_id.takaful_sponsorship_id | partials.credit_move_id.move_id.takaful_sponsorship_id)
|
||||
move.takaful_sponsorship_id = takaful_sponsorship_ids[-1] if takaful_sponsorship_ids else False
|
||||
else:
|
||||
move.takaful_sponsorship_id = move.takaful_sponsorship_id
|
||||
def action_move_line_create(self):
|
||||
'''
|
||||
Confirm the vouchers given in ids and create the journal entries for each of them
|
||||
|
|
@ -239,5 +248,5 @@ class AccountMove(models.Model):
|
|||
class AccountMoveLines(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
takaful_sponsorship_id = fields.Many2one('takaful.sponsorship')
|
||||
takaful_sponsorship_id = fields.Many2one('takaful.sponsorship', related='move_id.takaful_sponsorship_id', store=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ class DonationsDetailsLines(models.Model):
|
|||
_inherit = ['mail.thread']
|
||||
_rec_name = 'sequence_no'
|
||||
|
||||
@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
|
||||
|
||||
name = fields.Text(string="Note")
|
||||
display_type = fields.Selection([
|
||||
('line_section', "Section"),
|
||||
|
|
@ -82,6 +87,7 @@ class DonationsDetailsLines(models.Model):
|
|||
hide_beneficiary_group = fields.Boolean(compute='_compute_hide_beneficiary_group')
|
||||
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)
|
||||
# cheque_number = fields.Integer(string="Cheque Number")
|
||||
# cheque_due_date = fields.Date(string="Cheque Due Date")
|
||||
# cheque_file_attachment = fields.Binary(string='Cheque Attachment', attachment=True)
|
||||
|
|
@ -89,6 +95,7 @@ class DonationsDetailsLines(models.Model):
|
|||
# bank_transfer_file_attachment = fields.Binary(string='Bank Transfer Attachment', attachment=True)
|
||||
# bank_transfer_attachment_file_name = fields.Char('Bank Transfer File Name', required=False)
|
||||
|
||||
|
||||
@api.depends('extension_history_ids')
|
||||
def _compute_extension_count(self):
|
||||
for rec in self:
|
||||
|
|
@ -162,7 +169,7 @@ class DonationsDetailsLines(models.Model):
|
|||
rec.state = 'active'
|
||||
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(
|
||||
{'sponsor_related_id': sponsor_id, "sponsorship_end_date": rec.end_date if rec.end_date else False})
|
||||
{'sponsor_related_id': sponsor_id, 'kafala_status': 'have_kafala', "sponsorship_end_date": rec.end_date if rec.end_date else False})
|
||||
|
||||
@api.model
|
||||
def run_check_all_end_dates(self):
|
||||
|
|
@ -423,6 +430,8 @@ class DonationsDetailsLines(models.Model):
|
|||
if rec.sponsorship_duration == 'temporary' and not rec.direct_debit:
|
||||
rec.start_date = fields.Date.context_today(rec)
|
||||
|
||||
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(DonationsDetailsLines, self).default_get(fields)
|
||||
|
|
@ -934,7 +943,6 @@ class DonationsDetailsLines(models.Model):
|
|||
"""
|
||||
Open wizard to extend donation detail line
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
|
|
@ -943,9 +951,7 @@ class DonationsDetailsLines(models.Model):
|
|||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_donation_detail_id': self.id,
|
||||
'default_current_end_date': self.end_date,
|
||||
'default_amount': self.product_template_id.list_price,
|
||||
'donation_detail_ids': self.ids,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,17 @@ class FamilyMember(models.Model):
|
|||
string='Donation Details',
|
||||
compute='_compute_donation_details_count'
|
||||
)
|
||||
sponsor_id = fields.Many2one('res.partner', string='Sponsor Partner', domain="[('is_sponsor_portal', '=', True)]")
|
||||
sponsor_related_id = fields.Many2one('res.partner', string='Sponsor')
|
||||
sponsorship_id = fields.Many2one('takaful.sponsorship', string='Sponsorship')
|
||||
sponsorship_end_date = fields.Date(string='Sponsorship End Date')
|
||||
is_restricted = fields.Boolean(string="Is Restricted ?", default=False, readonly=True)
|
||||
general_restriction = fields.Boolean(string="General Restriction", default=False, readonly=True)
|
||||
kafala_status = fields.Selection(
|
||||
[('have_kafala', 'Have Kafala'), ('have_not_kafala', 'Have not Kafala')],
|
||||
string='Kafala Status', default='have_not_kafala')
|
||||
|
||||
|
||||
|
||||
def _compute_donation_details_count(self):
|
||||
for rec in self:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class ProductTemplate(models.Model):
|
|||
|
||||
donation_category = fields.Selection(
|
||||
[('donation', 'Donation'), ('sponsorship', 'Sponsorship'), ('endowment', 'Endowment')],
|
||||
string='Donation Category', required=True, default='donation')
|
||||
string='Donation Category')
|
||||
fixed_value = fields.Boolean(string='Is Fixed Value?', compute='_compute_fixed_value')
|
||||
sponsorship_duration = fields.Selection([('temporary', 'Temporary'), ('permanent', 'Permanent')],
|
||||
string='Sponsorship Duration Type')
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ from odoo.exceptions import UserError, ValidationError, Warning
|
|||
from dateutil.parser import parse
|
||||
import re
|
||||
from odoo.osv import expression
|
||||
SAUDI_MOBILE_PATTERN = r"^(05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$"
|
||||
|
||||
SAUDI_MOBILE_PATTERN = r"^(\+?966)?0?5[013456789][0-9]{7}$"
|
||||
|
||||
class IrActionsServer(models.Model):
|
||||
_inherit = 'ir.actions.server'
|
||||
|
|
@ -407,3 +406,15 @@ class ResPartner(models.Model):
|
|||
else:
|
||||
rec.name = " "
|
||||
|
||||
class ResPartnerBank(models.Model):
|
||||
_inherit = 'res.partner.bank'
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for bank in self:
|
||||
if bank.bank_id:
|
||||
name = f"{bank.acc_number} - {bank.bank_id.name}"
|
||||
else:
|
||||
name = f"{bank.acc_number}"
|
||||
result.append((bank.id, name))
|
||||
return result
|
||||
|
|
@ -15,7 +15,7 @@ import requests
|
|||
from odoo.osv import expression
|
||||
import logging
|
||||
|
||||
SAUDI_MOBILE_PATTERN = r"^(05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$"
|
||||
SAUDI_MOBILE_PATTERN = r"^(\+?966)?0?5[013456789][0-9]{7}$"
|
||||
|
||||
|
||||
def trunc_datetime(someDate):
|
||||
|
|
@ -755,6 +755,7 @@ class TakafulSponsorship(models.Model):
|
|||
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
|
||||
line.tax_ids = taxes
|
||||
line.product_uom_id = line._get_computed_uom()
|
||||
bill_id.action_post()
|
||||
else:
|
||||
sponsorship.state = sponsorship.state
|
||||
|
||||
|
|
@ -1068,90 +1069,11 @@ class TakafulSponsorship(models.Model):
|
|||
rec.expected_cancel_date = None
|
||||
rec.due_days = 0
|
||||
|
||||
# On Change
|
||||
# @api.onchange('sponsorship_class', 'sponsorship_type', 'benefit_id', 'benefit_ids')
|
||||
# def sponsorship_fully_value(self):
|
||||
# if self.sponsorship_class == 'fully' and self.benefit_ids and self.sponsorship_type == 'group':
|
||||
# self.update({'contribution_value': sum(
|
||||
# self.benefit_ids.mapped('benefit_needs_value'))})
|
||||
# elif self.sponsorship_class == 'fully' and self.benefit_id and self.sponsorship_type == 'person':
|
||||
# self.update(
|
||||
# {'contribution_value': self.benefit_id.benefit_needs_value})
|
||||
# else:
|
||||
# self.update({'contribution_value': 0})
|
||||
|
||||
# @api.constrains('contribution_value')
|
||||
# def check_contribution_value(self):
|
||||
# if not self.sponsor_id:
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select The Sponsor'))
|
||||
|
||||
# if not self.sponsorship_type:
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select Sponsorship Type'))
|
||||
#
|
||||
# if not self.benefit_type:
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select Sponsorship Beneficiary Type'))
|
||||
#
|
||||
# if not self.sponsorship_class:
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select Sponsorship Class'))
|
||||
#
|
||||
# if not self.sponsorship_duration:
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select Sponsorship Duration'))
|
||||
#
|
||||
# if not self.benefit_id and self.sponsorship_type == 'person':
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select a Beneficiary For Sponsorship Person'))
|
||||
#
|
||||
# if len(self.benefit_ids) < 2 and self.sponsorship_type == 'group':
|
||||
# raise ValidationError(
|
||||
# _(u'Please Select At least Two Beneficiaries For Sponsorship Group'))
|
||||
#
|
||||
# if self.sponsorship_class == 'partial':
|
||||
# default_sponsorship = int(
|
||||
# self.env['ir.config_parameter'].sudo().get_param('odex_takaful_base.min_kafala', 0))
|
||||
#
|
||||
# if self.benefit_ids and self.sponsorship_type == 'group':
|
||||
# benefit_count = len(self.benefit_ids)
|
||||
# else:
|
||||
# benefit_count = 1
|
||||
#
|
||||
# if default_sponsorship <= 0:
|
||||
# raise ValidationError(
|
||||
# _(u'Min kafala value should be defined by administration'))
|
||||
#
|
||||
# total_sponsorship = default_sponsorship * benefit_count
|
||||
# if self.contribution_value < total_sponsorship:
|
||||
# raise ValidationError(
|
||||
# _(u'Kafala value should be equal or greater than') + ' ' + str(total_sponsorship))
|
||||
|
||||
# Model Operations
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('code', 'New') == 'New':
|
||||
vals['code'] = self.env['ir.sequence'].sudo().next_by_code('sponsorship.sequence')
|
||||
# if vals.get('benefit_type') == 'orphan':
|
||||
# main_code = self.env['ir.sequence'].sudo(
|
||||
# ).next_by_code('sponsorship.sequence')
|
||||
# sub_code = self.env['ir.sequence'].sudo().next_by_code(
|
||||
# 'sponsorship.orphan.sequence')
|
||||
# if main_code and sub_code:
|
||||
# defualt_code = 'OR/' + str(main_code) + '/' + sub_code
|
||||
# vals.update({"code": defualt_code})
|
||||
# if vals.get('code', 'New') == 'New':
|
||||
# vals['code'] = self.env['ir.sequence'].sudo().next_by_code('sponsorship.sequence')
|
||||
|
||||
# elif vals.get('benefit_type') == 'widow':
|
||||
# main_code = self.env['ir.sequence'].sudo(
|
||||
# ).next_by_code('sponsorship.sequence')
|
||||
# sub_code = self.env['ir.sequence'].sudo().next_by_code(
|
||||
# 'sponsorship.widow.sequence')
|
||||
# if main_code and sub_code:
|
||||
# defualt_code = 'WI/' + str(main_code) + '/' + sub_code
|
||||
# vals.update({"code": defualt_code})
|
||||
|
||||
# Valid Sponsor Mobile
|
||||
sponsor_phone = vals.get('sponsor_phone', False)
|
||||
if sponsor_phone:
|
||||
self._check_phone_numbers(sponsor_phone)
|
||||
|
|
@ -1259,9 +1181,18 @@ class TakafulSponsorship(models.Model):
|
|||
raise ValidationError(
|
||||
_("Please add at least one line in donation details!")
|
||||
)
|
||||
|
||||
all_donation_lines = (self.donations_details_lines + self.donations_details_lines_mechanism_ids).filtered(lambda r: r.display_type == False)
|
||||
|
||||
#Check if The Total Amount is not Zero
|
||||
if self.total_sponsorship_amount == 0:
|
||||
raise ValidationError(
|
||||
_("Please Check The Amount in donation Line!")
|
||||
)
|
||||
|
||||
all_donation_lines = (self.donations_details_lines + self.donations_details_lines_mechanism_ids).filtered(
|
||||
lambda r: r.display_type == False)
|
||||
|
||||
if not self.code:
|
||||
self.code = self.env['ir.sequence'].sudo().next_by_code('sponsorship.sequence')
|
||||
|
||||
for line in all_donation_lines.filtered(lambda r: r.record_type == 'sponsorship'):
|
||||
for benefit in (line.benefit_id | line.benefit_ids):
|
||||
if benefit.sponsor_related_id:
|
||||
|
|
@ -1743,6 +1674,15 @@ class TakafulSponsorship(models.Model):
|
|||
sponsorship_line_ids = (rec.donations_details_lines | rec.donations_details_lines_mechanism_ids).filtered(lambda l: not l.direct_debit)
|
||||
rec.show_register_payment = rec.with_context(exclude_direct_debit=True).amount_paid < sum(sponsorship_line_ids.mapped('total_donation_amount'))
|
||||
|
||||
def action_reset_to_draft(self):
|
||||
for rec in self:
|
||||
if rec.state != 'confirmed':
|
||||
raise ValidationError(_("You can only reset to draft a confirmed sponsorship."))
|
||||
move_ids = rec.journal_entry_ids.filtered(lambda l: l.move_type == 'out_invoice')
|
||||
move_ids.button_draft()
|
||||
move_ids.button_cancel()
|
||||
self.write({'state': 'draft'})
|
||||
|
||||
class AnotherSponsors(models.Model):
|
||||
_name = "donate.for.another.person"
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ access_group_kufula_user_account_partial_reconcile,access_group_kufula_user_acco
|
|||
access_group_kufula_user_account_full_reconcile,access_group_kufula_user_account_full_reconcile,account.model_account_full_reconcile,odex_takaful.group_kufula_user,1,1,1,0
|
||||
access_donation_extension_wizard,donation.extension.wizard.access,model_donation_extension_wizard,base.group_user,1,1,1,1
|
||||
access_donation_extension_history,donation.extension.history.access,model_donation_extension_history,odex_takaful.group_kufula_user,1,1,1,0
|
||||
access_donation_extension_wizard_line,donation.extension.wizard.line.access,model_donation_extension_wizard_line,odex_takaful.group_kufula_user,1,1,1,0
|
||||
|
||||
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,odex_takaful.group_replace_sponsor,1,1,1,1
|
||||
|
||||
|
|
|
|||
|
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -0,0 +1,16 @@
|
|||
<odoo>
|
||||
<!-- Inherit form account move view -->
|
||||
<record id="takaful_account_move_inherit_form" model="ir.ui.view">
|
||||
<field name="name">takaful.account.move.inherit.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='invoice_origin']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': False}</attribute>
|
||||
|
||||
</xpath>
|
||||
|
||||
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -13,10 +13,32 @@
|
|||
widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='sponsor_related_id']" position="after">
|
||||
<field name="sponsorship_end_date" readonly="1"/>
|
||||
<field name="is_restricted" widget="boolean_toggle"/>
|
||||
<field name="general_restriction" widget="boolean_toggle"/>
|
||||
<xpath expr="//field[@name='sponsor_related_id']" position="replace">
|
||||
|
||||
<field name="sponsor_related_id" readonly="1" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[4]" position="after">
|
||||
<page name="kafala_info" string="Kafala Information">
|
||||
<group>
|
||||
<field name="kafala_status" readonly="1"/>
|
||||
<field name="sponsor_related_id"
|
||||
readonly="1"/>
|
||||
<field name="sponsor_id"
|
||||
attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"
|
||||
invisible="1"/>
|
||||
|
||||
<field name="sponsorship_id" invisible="1"
|
||||
attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
|
||||
|
||||
<field name="sponsorship_end_date" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_restricted" widget="boolean_toggle"/>
|
||||
<field name="general_restriction" widget="boolean_toggle"/>
|
||||
</group>
|
||||
|
||||
</page>
|
||||
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//header" position="inside">
|
||||
|
|
@ -41,6 +63,11 @@
|
|||
<field name="arch" type="xml">
|
||||
<field name="benefit_id" position="after">
|
||||
<separator/>
|
||||
<filter name="have_kafala" string="Have Kafala"
|
||||
domain="[('kafala_status','=','have_kafala')]"/>
|
||||
<filter name="have_not_kafala" string="Have not Kafala"
|
||||
domain="[('kafala_status','=','have_not_kafala')]"/>
|
||||
<separator/>
|
||||
<filter name="orphan_benefit_type" string="Orphans"
|
||||
domain="[('relationn_type', 'in', ['son', 'daughter'])]"/>
|
||||
<filter name="widow_benefit_type" string="Widows"
|
||||
|
|
@ -72,4 +99,17 @@
|
|||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_family_member_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">family.member.tree.inherit</field>
|
||||
<field name="model">family.member</field>
|
||||
<field name="inherit_id" ref="odex_benefit.family_member_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='member_status']" position="after">
|
||||
<field name="kafala_status" widget="badge"
|
||||
decoration-success="kafala_status == 'have_kafala'"
|
||||
decoration-danger="kafala_status == 'have_not_kafala'"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon.png" groups="odex_takaful.donation_officer_group"/>
|
||||
|
||||
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon5.png" groups="odex_takaful.group_kufula_user"/>
|
||||
|
||||
<!-- Main Kafalat-->
|
||||
<menuitem id="kafalat_main_menu" parent="takaful_kufula_app_top_menu"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@
|
|||
<button name="action_confirm_data" type="object"
|
||||
string="Confirm Data" class="oe_highlight"
|
||||
attrs="{'invisible': ['|','|', ('state','!=','draft'), ('id','=',False), '&',('sponsor_or_donor_type','=','new_sponsor'),('sponsor_id','=',False)]}"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
string="Reset to Draft" class="oe_highlight"
|
||||
attrs="{'invisible': [('state','!=','confirmed')]}"/>
|
||||
<button string="Pay All Sponsorships" name="action_register_payment" type="object"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', 'not in', ['confirmed', 'wait_pay','under_replacement','replacement_done']), ('show_register_payment', '=', False)]}"/>
|
||||
|
|
@ -181,10 +184,10 @@
|
|||
</page>
|
||||
<page string="Donation Details">
|
||||
<field name="donations_details_lines"
|
||||
context="{'default_active_id': active_id,'default_donation_mechanism': donation_mechanism,'default_start_date': sponsorship_creation_date}"
|
||||
context="{'default_active_id': active_id,'default_donation_mechanism': 'without_conditions','default_start_date': sponsorship_creation_date}"
|
||||
widget="section_and_note_one2many"
|
||||
attrs="{'invisible': ['|',('donation_mechanism', '=', 'with_conditions'),('record_type', '!=', 'donation')], 'readonly': [('state','!=','draft')]}">
|
||||
<tree editable="bottom" class="fix_overflow">
|
||||
<tree editable="bottom">
|
||||
<control>
|
||||
<create name="add_line_control" string="Add a line"/>
|
||||
<create name="add_section_control" string="Add a section"
|
||||
|
|
@ -215,6 +218,9 @@
|
|||
attrs="{'required': [('display_type', '=', False)]}"/>
|
||||
<field name="name" widget="section_and_note_text" optional="show"/>
|
||||
<field name="direct_debit"/>
|
||||
<field name="journal_id"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
|
||||
<!-- <field name="cheque_number"
|
||||
attrs="{'required': [('payment_method', '=', 'check')], 'invisible': [('payment_method', '!=', 'check')]}"/>
|
||||
<field name="cheque_due_date"
|
||||
|
|
@ -413,6 +419,9 @@
|
|||
<field name="sponsor_id" invisible="1"/>
|
||||
<field name="direct_debit_partner_bank_id" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': sponsor_id}"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
<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)]}"/>
|
||||
|
|
@ -478,7 +487,7 @@
|
|||
<page string="Orphans and Widows List"
|
||||
attrs="{'invisible': [('sponsorship_type', '!=', 'group')]}">
|
||||
<!-- attrs="{'invisible': ['|', '|', '|', ('hide_beneficiary_group','=', True), ('parent.record_type','!=','sponsorship'), ('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'both')]}">-->
|
||||
<field name="benefit_ids" nolabel="1">
|
||||
<field name="benefit_ids" nolabel="1" options="{'no_create': True}">
|
||||
<tree editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="age"/>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
|
||||
@api.depends('source_amount', 'source_amount_currency', 'source_currency_id', 'company_id', 'currency_id', 'payment_date')
|
||||
def _compute_amount(self):
|
||||
if self.env.context.get('sponsorship_payment'):
|
||||
if self.env.context.get('sponsorship_payment_skip_compute_amount'):
|
||||
self.amount = self.amount
|
||||
else:
|
||||
super(AccountRegisterPayment, self)._compute_amount()
|
||||
|
|
@ -65,7 +65,6 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
|
||||
payments = super(AccountRegisterPayment, self)._create_payments()
|
||||
if sponsorship_lines:
|
||||
sponsorship = sponsorship_lines.sponsorship_id or sponsorship_lines.sponsorship_mechanism_id
|
||||
|
||||
for line in sponsorship_lines:
|
||||
state = ''
|
||||
|
|
@ -119,6 +118,7 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
|
||||
line.tax_ids = taxes
|
||||
line.product_uom_id = line._get_computed_uom()
|
||||
bill_id.action_post()
|
||||
for line in sponsorship_lines:
|
||||
if line.record_type != 'sponsorship':
|
||||
continue
|
||||
|
|
@ -126,19 +126,20 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
line.benefit_ids.write({
|
||||
'sponsor_related_id': line.sponsorship_mechanism_id.sponsor_id.id,
|
||||
'sponsorship_id': line.sponsorship_mechanism_id.id,
|
||||
'sponsorship_end_date': line.end_date if line.end_date else False
|
||||
'sponsorship_end_date': line.end_date if line.end_date else False,
|
||||
'kafala_status': 'have_kafala',
|
||||
})
|
||||
if line.sponsorship_type == 'person':
|
||||
line.benefit_id.write({
|
||||
'sponsor_related_id': line.sponsorship_mechanism_id.sponsor_id.id,
|
||||
'sponsorship_id': line.sponsorship_mechanism_id.id,
|
||||
'sponsorship_end_date': line.end_date if line.end_date else False
|
||||
'sponsorship_end_date': line.end_date if line.end_date else False,
|
||||
'kafala_status': 'have_kafala',
|
||||
})
|
||||
line.sponsorship_mechanism_id.sponsor_id.sudo().is_sponsor_portal = True
|
||||
|
||||
if self.env.context.get('is_direct_debit'):
|
||||
payments.write({'direct_debit': True})
|
||||
payments.move_id.write({'takaful_sponsorship_id': sponsorship.id})
|
||||
|
||||
if self.transaction_file_attachment:
|
||||
self.env['ir.attachment'].sudo().create({
|
||||
|
|
|
|||
|
|
@ -10,29 +10,15 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
_name = 'donation.extension.wizard'
|
||||
_description = "Donation Extension Wizard"
|
||||
|
||||
donation_detail_id = fields.Many2one(
|
||||
'donations.details.lines',
|
||||
string='Donation Detail',
|
||||
line_ids = fields.One2many(
|
||||
'donation.extension.wizard.line',
|
||||
'wizard_id',
|
||||
string='Lines',
|
||||
required=True,
|
||||
readonly=True
|
||||
default=lambda self: self._compute_line_ids(),
|
||||
)
|
||||
|
||||
amount = fields.Float(
|
||||
string='Monthly Extension Amount',
|
||||
required=True,
|
||||
help='Amount per month for the extension period'
|
||||
)
|
||||
fixed_value = fields.Boolean(
|
||||
string='Is Fixed Value?',
|
||||
related='donation_detail_id.product_template_id.fixed_value'
|
||||
)
|
||||
total_months_amount = fields.Float(
|
||||
string='Total Months Amount',
|
||||
compute='_compute_total_months_amount',
|
||||
store=True,
|
||||
readonly=True,
|
||||
help='Total amount for the extension period'
|
||||
)
|
||||
direct_debit = fields.Boolean(string='Direct Debit', required=True)
|
||||
|
||||
months = fields.Integer(
|
||||
string='Extension Months',
|
||||
|
|
@ -40,6 +26,97 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
default=1,
|
||||
help='Number of months to extend'
|
||||
)
|
||||
|
||||
def _compute_line_ids(self):
|
||||
extension_line_ids = [(5,)]
|
||||
donation_detail_ids = self.env['donations.details.lines'].browse(self.env.context.get('donation_detail_ids'))
|
||||
for line in donation_detail_ids:
|
||||
if not (line.record_type == 'donation' and line.direct_debit) and line.record_type != 'sponsorship':
|
||||
raise ValidationError(_("Only donation with direct debit or sponsorship can be extended. Line: %s") % line.name)
|
||||
if line.end_date and line.end_date < fields.Date.context_today(line):
|
||||
raise ValidationError(_("Only active donations with end date in the future can be extended. Line: %s") % line.name)
|
||||
if line.state != 'active':
|
||||
raise ValidationError(_("Only active donations can be extended. Line: %s") % line.name)
|
||||
extension_line_ids.append((0, 0, {
|
||||
'donation_line_id': line.id,
|
||||
'current_end_date': line.end_date,
|
||||
}))
|
||||
return extension_line_ids
|
||||
|
||||
@api.constrains('months')
|
||||
def _check_months(self):
|
||||
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):
|
||||
"""
|
||||
Extend the donation detail line with new amount and months
|
||||
"""
|
||||
invoice_ids = self.env['account.move']
|
||||
donation_line_ids = self.env['donations.details.lines']
|
||||
for line in self.line_ids:
|
||||
result = line._extend()
|
||||
if result:
|
||||
invoice_ids += result[0]
|
||||
donation_line_ids += result[1]
|
||||
|
||||
if invoice_ids:
|
||||
return {
|
||||
'name': _('Register Payment'),
|
||||
'res_model': 'account.payment.register',
|
||||
'view_mode': 'form',
|
||||
'context': {
|
||||
'active_model': 'account.move',
|
||||
'active_ids': invoice_ids.ids,
|
||||
'dont_redirect_to_payments': True,
|
||||
'sponsorship_line_ids': donation_line_ids.ids,
|
||||
'sponsorship_payment': True,
|
||||
'default_sponsorship_payment': True,
|
||||
},
|
||||
'target': 'new',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('Success'),
|
||||
'message': _('Donation has been extended for %s month(s).') % (
|
||||
self.months,
|
||||
),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.act_window_close'}
|
||||
}
|
||||
}
|
||||
|
||||
def action_cancel(self):
|
||||
"""
|
||||
Cancel the wizard
|
||||
"""
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
class DonationExtensionWizardLine(models.TransientModel):
|
||||
_name = 'donation.extension.wizard.line'
|
||||
_description = "Donation Extension Wizard Line"
|
||||
|
||||
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)
|
||||
direct_debit = fields.Boolean()
|
||||
total_months_amount = fields.Float(
|
||||
string='Total Months Amount',
|
||||
compute='_compute_total_months_amount',
|
||||
store=True,
|
||||
readonly=True,
|
||||
help='Total amount for the extension period'
|
||||
)
|
||||
|
||||
total_donation_amount = fields.Float(
|
||||
string='Total Extension Amount',
|
||||
|
|
@ -60,20 +137,31 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
readonly=True
|
||||
)
|
||||
|
||||
direct_debit = fields.Boolean(string='Direct Debit', required=True)
|
||||
# related
|
||||
record_type = fields.Selection(related='donation_line_id.record_type')
|
||||
sponsorship_type = fields.Selection(related='donation_line_id.sponsorship_type')
|
||||
donation_amount = fields.Float(related='donation_line_id.donation_amount', store=True)
|
||||
benefits_count = fields.Integer(related='donation_line_id.benefits_count')
|
||||
sponsorship_id = fields.Many2one(related='donation_line_id.sponsorship_id')
|
||||
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')
|
||||
|
||||
@api.depends('amount', 'months')
|
||||
@api.depends('benefits_count', 'donation_amount', 'months', 'donation_qty', 'record_type', 'sponsorship_type')
|
||||
def _compute_total_donation_amount(self):
|
||||
for rec in self:
|
||||
if rec.donation_detail_id.sponsorship_type == 'group':
|
||||
rec.total_donation_amount = rec.donation_detail_id.benefits_count * rec.total_months_amount
|
||||
else :
|
||||
rec.total_donation_amount = rec.total_months_amount
|
||||
if rec.record_type == 'donation':
|
||||
if rec.sponsorship_id.donation_mechanism == 'without_conditions':
|
||||
rec.total_donation_amount = rec.donation_amount * rec.donation_qty
|
||||
else:
|
||||
rec.total_donation_amount = rec.total_months_amount
|
||||
else:
|
||||
rec.total_donation_amount = rec.total_months_amount * rec.benefits_count
|
||||
|
||||
@api.depends('amount', 'months')
|
||||
@api.depends('donation_amount', 'months')
|
||||
def _compute_total_months_amount(self):
|
||||
for rec in self:
|
||||
rec.total_months_amount = rec.amount * rec.months
|
||||
rec.total_months_amount = rec.donation_amount * rec.months
|
||||
|
||||
@api.depends('current_end_date', 'months')
|
||||
def _compute_new_end_date(self):
|
||||
|
|
@ -83,25 +171,15 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
else:
|
||||
rec.new_end_date = False
|
||||
|
||||
@api.constrains('months')
|
||||
def _check_months(self):
|
||||
@api.depends('donation_line_id')
|
||||
def _compute_donation_qty(self):
|
||||
for rec in self:
|
||||
if rec.months <= 0:
|
||||
raise ValidationError(_("Extension months must be greater than 0."))
|
||||
|
||||
@api.constrains('amount')
|
||||
def _check_amount(self):
|
||||
for rec in self:
|
||||
if rec.amount <= 0:
|
||||
raise ValidationError(_("Extension amount must be greater than 0."))
|
||||
|
||||
def action_extend(self):
|
||||
"""
|
||||
Extend the donation detail line with new amount and months
|
||||
"""
|
||||
rec.donation_qty = rec.donation_line_id.donation_qty
|
||||
|
||||
def _extend(self):
|
||||
self.ensure_one()
|
||||
|
||||
if not self.donation_detail_id:
|
||||
if not self.donation_line_id:
|
||||
raise ValidationError(_("No donation detail line selected."))
|
||||
|
||||
# Update the donation detail line
|
||||
|
|
@ -109,16 +187,17 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
old_end_date = self.current_end_date
|
||||
|
||||
# Update end date
|
||||
self.donation_detail_id.write({
|
||||
self.donation_line_id.write({
|
||||
'end_date': new_end_date,
|
||||
'donation_amount': self.total_months_amount,
|
||||
'payment_month_count': self.donation_detail_id.payment_month_count + self.months,
|
||||
'payment_month_count': self.donation_line_id.payment_month_count + self.months,
|
||||
# 'state': 'extended',
|
||||
})
|
||||
|
||||
benefit_ids = self.donation_detail_id.benefit_ids | self.donation_detail_id.benefit_id
|
||||
benefit_ids = self.donation_line_id.benefit_ids | self.donation_line_id.benefit_id
|
||||
benefit_ids.write({
|
||||
'sponsorship_end_date': new_end_date,
|
||||
'kafala_status': 'have_kafala',
|
||||
})
|
||||
|
||||
# Create new scheduling lines for the extension period
|
||||
|
|
@ -130,52 +209,23 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
|
||||
# Create extension history record
|
||||
self.env['donation.extension.history'].create({
|
||||
'donation_detail_id': self.donation_detail_id.id,
|
||||
'sponsorship_id': self.donation_detail_id.sponsorship_id.id or self.donation_detail_id.sponsorship_mechanism_id.id,
|
||||
'donation_detail_id': self.donation_line_id.id,
|
||||
'sponsorship_id': self.donation_line_id.sponsorship_id.id or self.donation_line_id.sponsorship_mechanism_id.id,
|
||||
'extension_amount': self.total_donation_amount,
|
||||
'extension_months': self.months,
|
||||
'old_end_date': old_end_date,
|
||||
'new_end_date': new_end_date,
|
||||
'invoice_id': invoice_id.id if invoice_id else False,
|
||||
'old_direct_debit': self.donation_detail_id.direct_debit,
|
||||
'old_direct_debit': self.donation_line_id.direct_debit,
|
||||
'new_direct_debit': self.direct_debit,
|
||||
})
|
||||
|
||||
if not self.direct_debit:
|
||||
result = {
|
||||
'name': _('Register Payment'),
|
||||
'res_model': 'account.payment.register',
|
||||
'view_mode': 'form',
|
||||
'context': {
|
||||
'active_model': 'account.move',
|
||||
'active_ids': invoice_id.ids,
|
||||
'default_amount': self.total_donation_amount,
|
||||
'dont_redirect_to_payments': True,
|
||||
'sponsorship_line_ids': self.donation_detail_id.ids,
|
||||
'sponsorship_payment': True,
|
||||
'default_sponsorship_payment': True,
|
||||
'force_sponsorship_line_partner_id': self.donation_detail_id.sponsor_id.id,
|
||||
},
|
||||
'target': 'new',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
else:
|
||||
result = {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'title': _('Success'),
|
||||
'message': _('Donation has been extended for %s month(s) until %s') % (
|
||||
self.months,
|
||||
new_end_date.strftime('%Y-%m-%d')
|
||||
),
|
||||
'type': 'success',
|
||||
'sticky': False,
|
||||
'next': {'type': 'ir.actions.act_window_close'}
|
||||
}
|
||||
}
|
||||
return invoice_id, self.donation_line_id
|
||||
|
||||
|
||||
return result
|
||||
return False
|
||||
|
||||
|
||||
def _create_extension_scheduling_lines(self):
|
||||
"""
|
||||
|
|
@ -183,7 +233,7 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
"""
|
||||
self.ensure_one()
|
||||
|
||||
donation_line = self.donation_detail_id
|
||||
donation_line = self.donation_line_id
|
||||
start_date = self.current_end_date + relativedelta(months=1)
|
||||
|
||||
# Distribute total amount across months
|
||||
|
|
@ -214,7 +264,7 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
"""
|
||||
self.ensure_one()
|
||||
|
||||
donation_line = self.donation_detail_id
|
||||
donation_line = self.donation_line_id
|
||||
sponsorship = donation_line.sponsorship_id or donation_line.sponsorship_mechanism_id
|
||||
|
||||
# Get journal from settings
|
||||
|
|
@ -258,10 +308,4 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
invoice_id.action_post()
|
||||
|
||||
return invoice_id
|
||||
|
||||
def action_cancel(self):
|
||||
"""
|
||||
Cancel the wizard
|
||||
"""
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
|
|
@ -7,21 +7,37 @@
|
|||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<field name="donation_detail_id" invisible="1"/>
|
||||
<group>
|
||||
<group string="Extension Details">
|
||||
<field name="months"/>
|
||||
<field name="direct_debit"/>
|
||||
<field name="fixed_value" invisible="1"/>
|
||||
<field name="amount"
|
||||
attrs="{'readonly':[('fixed_value','=',True)]}"/>
|
||||
<field name="total_donation_amount"/>
|
||||
</group>
|
||||
<group string="Date Information">
|
||||
<field name="current_end_date" readonly="1"/>
|
||||
<field name="new_end_date"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Lines">
|
||||
<field name="line_ids" nolabel="1">
|
||||
<tree create="0" editable="bottom">
|
||||
<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="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="donation_amount" string="Amount" 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"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="action_extend" type="object" string="Extend" class="oe_highlight"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue