Merge pull request #5551 from expsa/extend_donation_payment
Extend donation payment
This commit is contained in:
commit
2caf9282ec
|
|
@ -2229,7 +2229,6 @@ msgid "Expire Membership"
|
|||
msgstr "انتهاء العضوية"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
|
||||
msgid "Extend"
|
||||
msgstr "تمديد"
|
||||
|
|
@ -7048,7 +7047,6 @@ msgstr ""
|
|||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.add_details_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.refund_wizard_form
|
||||
msgid "or"
|
||||
msgstr "أو"
|
||||
|
|
@ -7509,46 +7507,6 @@ msgstr "سجل الإستبدال"
|
|||
msgid "Paid"
|
||||
msgstr "منتهي"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__check_number
|
||||
msgid "Check Number"
|
||||
msgstr "رقم الشيك"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__journal_id
|
||||
msgid "Journal"
|
||||
msgstr "حساب الجمعية"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__partner_bank_id
|
||||
msgid "Partner Bank"
|
||||
msgstr "بنك المتبرع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__payment_amount
|
||||
msgid "Payment Amount"
|
||||
msgstr "المبلغ"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__payment_file_attachment
|
||||
msgid "Payment Attachment"
|
||||
msgstr "مرفق الدفع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__payment_method
|
||||
msgid "Payment Method"
|
||||
msgstr "طريقة الدفع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__check_due_date
|
||||
msgid "Check Due Date"
|
||||
msgstr "تاريخ الإستحقاق"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_extension_payment_wizard_line__check_number
|
||||
msgid "Check Number"
|
||||
msgstr "رقم الشيك"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard__is_different_payment
|
||||
msgid "Is Different Payment"
|
||||
|
|
@ -7561,5 +7519,16 @@ msgstr "حساب الجمعية"
|
|||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard_form
|
||||
msgid "Sub Payments"
|
||||
msgstr "دفع متعدد"
|
||||
msgid "Extend"
|
||||
msgstr "تمديد/دفع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard__total_extension_amount
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard_line__total_donation_amount
|
||||
msgid "Total Extension Amount"
|
||||
msgstr "إجمالي مبلغ الدفع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_donation_extension_wizard__remaining_amount
|
||||
msgid "Remaining Amount"
|
||||
msgstr "المبلغ المتبقى"
|
||||
|
|
|
|||
|
|
@ -1137,6 +1137,7 @@ class DonationsDetailsLines(models.Model):
|
|||
'target': 'new',
|
||||
'context': {
|
||||
'donation_detail_ids': self.ids,
|
||||
'no_quick_close': True
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,16 @@
|
|||
<field name="perm_create" eval="1"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
</record>
|
||||
|
||||
<record id="branch_manager_restrictions_lines" model="ir.rule">
|
||||
<field name="name">Branch Manager can only see all his branch sponsorships and donations Lines</field>
|
||||
<field name="model_id" ref="model_donations_details_lines"/>
|
||||
<field name="groups" eval="[(4, ref('branch_manager_group'))]"/>
|
||||
<field name="domain_force">[('branch_custom_id.branch.manager_id.user_id', 'in', [user.id, False])]</field>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
</record>
|
||||
<record id="sponsorship_system_manager_group" model="res.groups">
|
||||
<field name="name">Sponsorship System Manager</field>
|
||||
<field name="category_id" ref="module_category_kufula"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
odoo.define('odex_takaful.hide_close_button', function (require) {
|
||||
"use strict";
|
||||
|
||||
const Dialog = require('web.Dialog');
|
||||
const ActionManager = require('web.ActionManager');
|
||||
|
||||
Dialog.include({
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
open: function () {
|
||||
var self = this;
|
||||
this.opened(function () {
|
||||
setTimeout(function () {
|
||||
var parent = self.getParent();
|
||||
|
||||
if (parent instanceof ActionManager) {
|
||||
|
||||
var action = parent.getCurrentActionInDialog();
|
||||
console.log(action);
|
||||
if (action) {
|
||||
|
||||
if (action.context) {
|
||||
let model = action.res_model;
|
||||
if (model === 'donation.extension.wizard' || model === 'account.payment.register') {
|
||||
if (self.$modal) {
|
||||
self.$modal.find('.modal-header button.close').hide();
|
||||
self.$modal.find('.modal-header .modal-title').css("width", "100%");
|
||||
}
|
||||
|
||||
if (self.$el) {
|
||||
self.$el.find('.o_cp_top_left').hide();
|
||||
self.$el.find('.o_cp_bottom_left').hide();
|
||||
self.$el.find('.o_cp_top_right').css("width", "100%");
|
||||
self.$el.find('.o_cp_bottom_right').css("width", "100%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<script type="text/javascript" src="/odex_takaful/static/src/js/product_product_views.js"/>
|
||||
<script type="text/javascript" src="/odex_takaful/static/src/js/donation_catalog_button.js"/>
|
||||
<script type="text/javascript" src="/odex_takaful/static/src/js/donation_catalog_controls.js"/>
|
||||
<script type="text/javascript" src="/odex_takaful/static/src/js/hide_close_button.js"/>
|
||||
<!-- <script type="text/javascript" src="/odex_takaful/static/src/js/catalog_kanban_dynamic_button.js"/>-->
|
||||
</xpath>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@
|
|||
<field name="sponsor_id" />
|
||||
|
||||
<field name="sponsor_phone" widget="phone"/>
|
||||
<field name="donation_type" optional="show"/>
|
||||
<field name="donation_type" optional="hide"/>
|
||||
<field name="sponsorship_duration" optional="hide"/>
|
||||
<field name="donation_mechanism" optional="hide"/>
|
||||
<field name="product_template_id" />
|
||||
<field name="benefit_status" widget="badge"
|
||||
decoration-success="benefit_status == 'benefit'"
|
||||
decoration-danger="benefit_status == 'non_benefit'"/>
|
||||
<field name="start_date" widget="date"/>
|
||||
<field name="end_date" widget="date"/>
|
||||
decoration-danger="benefit_status == 'non_benefit'" optional="hide"/>
|
||||
<field name="start_date" widget="date" optional="hide"/>
|
||||
<field name="end_date" widget="date" optional="hide"/>
|
||||
<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"/>
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
decoration-success="state in ['active', 'paid','confirmed']"
|
||||
decoration-danger="state == 'closed'"
|
||||
decoration-info="state == 'extended'" />
|
||||
<field name="age_category" widget="state" />
|
||||
<field name="age_category" widget="state" optional="hide"/>
|
||||
<button name="action_view_scheduling_lines"
|
||||
string="View Scheduling Lines"
|
||||
type="object"
|
||||
|
|
@ -365,15 +365,15 @@
|
|||
<field name="sequence_no" />
|
||||
<field name="sponsor_id" />
|
||||
<field name="sponsor_phone" widget="phone"/>
|
||||
<field name="donation_type" optional="show"/>
|
||||
<field name="donation_type" optional="hide"/>
|
||||
<field name="sponsorship_duration" optional="hide"/>
|
||||
<field name="donation_mechanism" optional="hide"/>
|
||||
<field name="product_template_id" />
|
||||
<field name="benefit_status" widget="badge"
|
||||
decoration-success="benefit_status == 'benefit'"
|
||||
decoration-danger="benefit_status == 'non_benefit'"/>
|
||||
<field name="start_date" widget="date"/>
|
||||
<field name="end_date" widget="date"/>
|
||||
<field name="start_date" widget="date" optional="hide"/>
|
||||
<field name="end_date" widget="date" optional="hide"/>
|
||||
<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"/>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
check_number = fields.Char(string='Check Number')
|
||||
check_due_date = fields.Date(string='Check Due Date')
|
||||
sponsorship_payment = fields.Boolean(string='Sponsorship Payment', default=False)
|
||||
show_cancel_button = fields.Boolean(
|
||||
string="Show Cancel Button",
|
||||
compute="_compute_show_cancel_button"
|
||||
)
|
||||
|
||||
@api.depends_context('wiz_id')
|
||||
def _compute_show_cancel_button(self):
|
||||
for rec in self:
|
||||
rec.show_cancel_button = not bool(self.env.context.get('wiz_id'))
|
||||
|
||||
|
||||
@api.onchange("machine_id")
|
||||
|
|
@ -197,7 +206,23 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
def action_create_payments(self):
|
||||
res = super(AccountRegisterPayment, self).action_create_payments()
|
||||
|
||||
if self.env.context.get('dont_redirect_to_payments'):
|
||||
if self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'):
|
||||
if self.amount < self.env.context.get('default_amount'):
|
||||
wiz = self.env['donation.extension.wizard'].browse(self.env.context.get('wiz_id'))
|
||||
wiz.paid_amount += self.amount
|
||||
wiz.is_different_payment = True
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Extend Donation'),
|
||||
'res_model': 'donation.extension.wizard',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'res_id': self.env.context.get('wiz_id'),
|
||||
'context': {
|
||||
'paid_amount': self.amount,
|
||||
'no_quick_close': True,
|
||||
},
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
|
|
@ -211,3 +236,24 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
}
|
||||
|
||||
return res
|
||||
|
||||
def action_cancel(self):
|
||||
wiz_id = self.env.context.get('wiz_id')
|
||||
|
||||
if wiz_id:
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Extend Donation'),
|
||||
'res_model': 'donation.extension.wizard',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'res_id': wiz_id,
|
||||
'context': {
|
||||
'paid_amount': self.amount or 0.0,
|
||||
'no_quick_close': True,
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,18 @@
|
|||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
||||
<field name="transaction_attachment_file_name" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//footer/button[2]" position="after">
|
||||
<field name="show_cancel_button" invisible="1"/>
|
||||
<button name="action_cancel"
|
||||
type="object"
|
||||
string="Cancel"
|
||||
class="btn-secondary"
|
||||
attrs="{'invisible': [('show_cancel_button', '=', True)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//footer/button[2]" position="attributes">
|
||||
<attribute name="attrs">{'invisible':[('show_cancel_button','=',False)]}</attribute>
|
||||
</xpath>
|
||||
|
||||
<!--<xpath expr="//group" position="after">-->
|
||||
<!-- <notebook>-->
|
||||
<!-- <page string="Sub Payments" attrs="{'invisible': [('group_payment', '=', False)]}">-->
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
compute='_compute_total_extension_amount',
|
||||
store=True,
|
||||
)
|
||||
|
||||
paid_amount = fields.Float(string="Paid Amount", readonly=True)
|
||||
remaining_amount = fields.Float(string="Remaining Amount", compute='_compute_total_remaining_amount',
|
||||
store=True,)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency',
|
||||
default=lambda self: self.env.company.currency_id, readonly=True)
|
||||
|
||||
|
||||
@api.depends('line_ids.total_donation_amount')
|
||||
|
|
@ -47,14 +51,19 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
for rec in self:
|
||||
rec.total_extension_amount = sum(line.total_donation_amount for line in rec.line_ids if line.direct_debit == False)
|
||||
|
||||
@api.constrains('is_different_payment', 'payment_line_ids')
|
||||
def _check_payment_sum_when_different(self):
|
||||
@api.depends('total_extension_amount','paid_amount')
|
||||
def _compute_total_remaining_amount(self):
|
||||
for rec in self:
|
||||
if not rec.is_different_payment:
|
||||
sum_payments = sum(line.payment_amount for line in rec.payment_line_ids)
|
||||
if float_compare(sum_payments, rec.total_extension_amount, precision_digits=2) != 0:
|
||||
raise ValidationError(_("Total payment amounts (%s) must equal total extension amount (%s).") %
|
||||
(sum_payments, rec.total_extension_amount))
|
||||
rec.remaining_amount = rec.total_extension_amount - rec.paid_amount
|
||||
|
||||
# @api.constrains('is_different_payment', 'payment_line_ids')
|
||||
# def _check_payment_sum_when_different(self):
|
||||
# for rec in self:
|
||||
# if not rec.is_different_payment:
|
||||
# sum_payments = sum(line.payment_amount for line in rec.payment_line_ids)
|
||||
# if float_compare(sum_payments, rec.total_extension_amount, precision_digits=2) != 0:
|
||||
# raise ValidationError(_("Total payment amounts (%s) must equal total extension amount (%s).") %
|
||||
# (sum_payments, rec.total_extension_amount))
|
||||
|
||||
def _compute_line_ids(self):
|
||||
extension_line_ids = [(5,)]
|
||||
|
|
@ -97,75 +106,34 @@ class DonationExtensionWizard(models.TransientModel):
|
|||
"""
|
||||
invoice_ids = self.env['account.move']
|
||||
donation_line_ids = self.env['donations.details.lines']
|
||||
amount = self.total_extension_amount - self.paid_amount
|
||||
|
||||
for line in self.line_ids:
|
||||
result = line._extend()
|
||||
if result:
|
||||
invoice_ids += result[0]
|
||||
donation_line_ids += result[1]
|
||||
|
||||
if invoice_ids and not self.is_different_payment:
|
||||
invoices = invoice_ids.filtered(
|
||||
lambda inv: inv.state == 'posted' and inv.move_type in ('out_invoice', 'out_refund'))
|
||||
if not invoices:
|
||||
return
|
||||
|
||||
residual_map = {inv.id: float(inv.amount_residual) for inv in invoices}
|
||||
|
||||
invoices = invoices.sorted(key=lambda r: r.invoice_date or r.date or fields.Date.context_today(self))
|
||||
|
||||
for pay_line in self.payment_line_ids:
|
||||
remaining = float(pay_line.payment_amount or 0.0)
|
||||
if float_compare(remaining, 0.0, precision_digits=2) <= 0:
|
||||
continue
|
||||
|
||||
candidate_invoices = invoices.filtered(lambda inv: inv.partner_id == pay_line.partner_id)
|
||||
|
||||
if not candidate_invoices:
|
||||
candidate_invoices = invoices
|
||||
|
||||
for inv in candidate_invoices:
|
||||
if float_compare(remaining, 0.0, precision_digits=2) <= 0:
|
||||
break
|
||||
|
||||
inv_res = residual_map.get(inv.id, 0.0)
|
||||
if float_compare(inv_res, 0.0, precision_digits=2) <= 0:
|
||||
continue
|
||||
|
||||
pay_amount = min(remaining, inv_res)
|
||||
|
||||
payment_register_vals = {
|
||||
'payment_type': 'inbound',
|
||||
'partner_type': 'customer',
|
||||
'partner_id': inv.partner_id.id,
|
||||
'amount': pay_amount,
|
||||
'journal_id': pay_line.journal_id.id,
|
||||
# 'payment_method_id': pay_line.payment_method.id,
|
||||
'communication': _("Extension Payment for %s") % inv.name,
|
||||
'transaction_file_attachment': pay_line.payment_file_attachment,
|
||||
|
||||
}
|
||||
|
||||
ctx = {
|
||||
'active_model': 'account.move',
|
||||
'active_ids': [inv.id],
|
||||
'dont_redirect_to_payments': True,
|
||||
'sponsorship_line_ids': donation_line_ids.ids,
|
||||
'sponsorship_payment': True,
|
||||
'default_sponsorship_payment': True,
|
||||
}
|
||||
|
||||
payment_register = self.env['account.payment.register'].sudo().with_context(ctx).new(
|
||||
payment_register_vals)
|
||||
payments = payment_register.action_create_payments()
|
||||
|
||||
inv_sudo = inv.sudo()
|
||||
inv_sudo.invalidate_cache(['amount_residual'])
|
||||
new_residual = float(inv_sudo.amount_residual or 0.0)
|
||||
residual_map[inv.id] = new_residual
|
||||
|
||||
remaining = remaining - pay_amount
|
||||
|
||||
|
||||
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,
|
||||
'default_amount': amount,
|
||||
'sponsorship_payment_skip_compute_amount': True,
|
||||
'dont_redirect_to_payments': True,
|
||||
'sponsorship_line_ids': self.line_ids.donation_line_id.ids,
|
||||
'sponsorship_payment': True,
|
||||
'default_sponsorship_payment': True,
|
||||
'wiz_id': self.id
|
||||
# 'force_sponsorship_line_partner_id': self.donation_detail_id.sponsor_id.id,
|
||||
},
|
||||
'target': 'new',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
|
|
@ -455,6 +423,7 @@ class DonationExtensionWizardLine(models.TransientModel):
|
|||
'journal_id': int(kafala_journal_id),
|
||||
'date': fields.Date.today(),
|
||||
'partner_id': sponsorship.sponsor_id.id,
|
||||
'invoice_origin': sponsorship.code,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'product_id': donation_line.product_id.id,
|
||||
'price_unit': self.total_donation_amount,
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@
|
|||
<field name="name">donation.extension.wizard.form</field>
|
||||
<field name="model">donation.extension.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<form class="o_form_noclose">
|
||||
<sheet>
|
||||
<group>
|
||||
<group string="Extension Details">
|
||||
<field name="months"/>
|
||||
<field name="months" attrs="{'readonly': [('is_different_payment', '=', True)]}"/>
|
||||
<field name="is_different_payment" invisible="1"/>
|
||||
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
|
@ -24,7 +27,7 @@
|
|||
<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="donation_line_id" force_save="1" optional="hide"/>
|
||||
<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"/>
|
||||
|
|
@ -36,7 +39,7 @@
|
|||
<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"/>
|
||||
options="{'currency_field': 'currency_id'}" force_save="1" sum="Total Amount"/>
|
||||
</tree>
|
||||
<form>
|
||||
<field name="wizard_id" invisible="1" force_save="1"/>
|
||||
|
|
@ -76,75 +79,26 @@
|
|||
</group>
|
||||
</form>
|
||||
</field>
|
||||
<group>
|
||||
<group>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="total_extension_amount" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
class="oe_inline"/>
|
||||
<field name="remaining_amount" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}"
|
||||
attrs="{'invisible': [('is_different_payment', '=', False)]}"
|
||||
class="oe_inline"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</page>
|
||||
<page string="Sub Payments" >
|
||||
<field name="payment_line_ids" nolabel="1">
|
||||
<tree editable="bottom" delete="true" create="true">
|
||||
<field name="payment_method" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="donation_line_ids" invisible="1"/>
|
||||
<field name="payment_method_type" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="journal_id" string="Association Journal"/>
|
||||
<field name="payment_amount" widget="monetary"
|
||||
options="{'currency_field': 'currency_id'}" force_save="1" sum="Total Amount"/>
|
||||
<field name="check_number"
|
||||
attrs="{
|
||||
'invisible': [
|
||||
('payment_method_type','!=','check')
|
||||
],
|
||||
'required': [
|
||||
('payment_method_type','=','check')
|
||||
]
|
||||
}"
|
||||
optional="hide"/>
|
||||
<field name="check_due_date"
|
||||
attrs="{
|
||||
'invisible': [
|
||||
('payment_method_type','!=','check')
|
||||
],
|
||||
'required': [
|
||||
('payment_method_type','=','check')
|
||||
]
|
||||
}"
|
||||
optional="hide"/>
|
||||
<field name="partner_bank_id"
|
||||
context="{
|
||||
'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create',
|
||||
'default_partner_id': context.get('force_sponsorship_line_partner_id')
|
||||
}"
|
||||
attrs="{
|
||||
'required': [
|
||||
('payment_method_type','=','bank')
|
||||
],
|
||||
'invisible': [
|
||||
('payment_method_type','!=','bank')
|
||||
]
|
||||
}"
|
||||
readonly="0"
|
||||
optional="hide"/>
|
||||
<field name="payment_file_attachment"
|
||||
widget="binary"
|
||||
filename="payment_file_attachment_name"
|
||||
attrs="{
|
||||
'invisible': [
|
||||
('payment_method_type','not in',['bank', 'check'])
|
||||
],
|
||||
'required': ['|',
|
||||
('payment_method_type','=','bank'),
|
||||
('payment_method_type','=','check')
|
||||
]
|
||||
}"
|
||||
optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="action_extend" type="object" string="Extend" class="oe_highlight"/>
|
||||
or
|
||||
<button name="action_cancel" type="object" string="Cancel" special="cancel"/>
|
||||
<button name="action_cancel" type="object" string="Cancel" special="cancel" attrs="{'invisible': [('is_different_payment', '=', True)]}"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
|||
Loading…
Reference in New Issue