Merge pull request #6140 from expsa/samir_aladawi_pay_button_donation_extension
[UPD] odex_takaful
This commit is contained in:
commit
bc64c34e13
|
|
@ -586,6 +586,12 @@ msgstr "كل الكفالات"
|
|||
msgid "Allowed Payments"
|
||||
msgstr "الدفعات المسموحة"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_benefit_category__allowed_sponsorship
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_family_member__allowed_sponsorship
|
||||
msgid "Allowed Sponsorship"
|
||||
msgstr "السماح للكفالة"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: code:addons/odex_takaful/reports/month_payment_report.py:0
|
||||
#: code:addons/odex_takaful/reports/month_payment_report.py:0
|
||||
|
|
@ -4481,6 +4487,11 @@ msgstr "شريك"
|
|||
msgid "Partner Bank"
|
||||
msgstr "بنك المتبرع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_history_form
|
||||
msgid "Pay"
|
||||
msgstr "سداد"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_form
|
||||
msgid "Pay All Sponsorships"
|
||||
|
|
|
|||
|
|
@ -161,3 +161,29 @@ class DonationExtensionHistory(models.Model):
|
|||
)
|
||||
else:
|
||||
rec.extension_ref = _('Extension')
|
||||
|
||||
def action_pay_invoice(self):
|
||||
self.ensure_one()
|
||||
|
||||
return {
|
||||
'name': _('Register Payment'),
|
||||
'res_model': 'account.payment.register',
|
||||
'view_mode': 'form',
|
||||
'context': {
|
||||
'active_model': 'account.move',
|
||||
'active_ids': self.invoice_id.ids,
|
||||
'default_amount': self.extension_amount,
|
||||
'sponsorship_payment_skip_compute_amount': True,
|
||||
'dont_redirect_to_payments': True,
|
||||
'sponsorship_line_ids': self.donation_detail_id.ids,
|
||||
'sponsorship_payment': True,
|
||||
'default_sponsorship_payment': True,
|
||||
'from_extension_history': True,
|
||||
'donation_extension_history_id': self.id,
|
||||
'sponsorship_id': self.sponsorship_id.id,
|
||||
'default_takaful_sponsorship_id': self.sponsorship_id.id,
|
||||
'force_sponsorship_line_partner_id': self.sponsor_id.id,
|
||||
},
|
||||
'target': 'new',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<form create="0" edit="0" delete="0">
|
||||
<header>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="active,paid,cancel" />
|
||||
<field name="state" widget="statusbar" statusbar_visible="active,paid,cancel" />
|
||||
<button string="Pay" name="action_pay_invoice" type="object" class="oe_highlight" states="active"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Canceld" bg_color="bg-danger" attrs="{'invisible': [('state', '!=', 'cancel')]}"/>
|
||||
|
|
|
|||
|
|
@ -373,7 +373,13 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
res = super(AccountRegisterPayment,
|
||||
self.with_context(skip_account_move_synchronization=True)).action_create_payments()
|
||||
|
||||
if self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'):
|
||||
donation_extension_history_id = self.env.context.get('donation_extension_history_id')
|
||||
if self.env.context.get('from_extension_history') and donation_extension_history_id and res:
|
||||
history = self.env['donation.extension.history'].browse(donation_extension_history_id)
|
||||
if history:
|
||||
history.sudo().write({'state': 'paid'})
|
||||
|
||||
elif self.env.context.get('dont_redirect_to_payments') and self.env.context.get('wiz_id'):
|
||||
if self.amount < self.env.context.get('default_amount'):
|
||||
wiz = self.env['donation.extension.wizard'].browse(self.env.context.get('wiz_id'))
|
||||
wiz.paid_amount += self.amount
|
||||
|
|
|
|||
Loading…
Reference in New Issue