mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] added render_folio_button method and folio_ids in payment_transaction view
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
"views/precheckin_portal_templates.xml",
|
"views/precheckin_portal_templates.xml",
|
||||||
"wizards/wizard_massive_changes.xml",
|
"wizards/wizard_massive_changes.xml",
|
||||||
"wizards/wizard_advanced_filters.xml",
|
"wizards/wizard_advanced_filters.xml",
|
||||||
|
"views/payment_transaction_views.xml",
|
||||||
],
|
],
|
||||||
"demo": [
|
"demo": [
|
||||||
"demo/pms_master_data.xml",
|
"demo/pms_master_data.xml",
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ class PortalFolio(CustomerPortal):
|
|||||||
transaction.ids
|
transaction.ids
|
||||||
)
|
)
|
||||||
request.session["__payment_tx_ids__"] = list(tx_ids_list)
|
request.session["__payment_tx_ids__"] = list(tx_ids_list)
|
||||||
|
return transaction.render_folio_button(
|
||||||
return transaction.render_invoice_button(
|
|
||||||
folio_sudo,
|
folio_sudo,
|
||||||
submit_txt=_("Pay & Confirm"),
|
submit_txt=_("Pay & Confirm"),
|
||||||
render_values={
|
render_values={
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from odoo import fields, models
|
from odoo import _, fields, models
|
||||||
|
|
||||||
|
|
||||||
class PaymentTransaction(models.Model):
|
class PaymentTransaction(models.Model):
|
||||||
@@ -20,3 +20,23 @@ class PaymentTransaction(models.Model):
|
|||||||
if self.folio_ids:
|
if self.folio_ids:
|
||||||
add_payment_vals["folio_ids"] = [(6, 0, self.folio_ids.ids)]
|
add_payment_vals["folio_ids"] = [(6, 0, self.folio_ids.ids)]
|
||||||
return super(PaymentTransaction, self)._create_payment(add_payment_vals)
|
return super(PaymentTransaction, self)._create_payment(add_payment_vals)
|
||||||
|
|
||||||
|
def render_folio_button(self, folio, submit_txt=None, render_values=None):
|
||||||
|
values = {
|
||||||
|
"partner_id": folio.partner_id.id,
|
||||||
|
"type": self.type,
|
||||||
|
}
|
||||||
|
if render_values:
|
||||||
|
values.update(render_values)
|
||||||
|
return (
|
||||||
|
self.acquirer_id.with_context(
|
||||||
|
submit_class="btn btn-primary", submit_txt=submit_txt or _("Pay Now")
|
||||||
|
)
|
||||||
|
.sudo()
|
||||||
|
.render(
|
||||||
|
self.reference,
|
||||||
|
folio.pending_amount,
|
||||||
|
folio.currency_id.id,
|
||||||
|
values=values,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|||||||
12
pms/views/payment_transaction_views.xml
Normal file
12
pms/views/payment_transaction_views.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="payment_transaction_inherit_view_form" model="ir.ui.view">
|
||||||
|
<field name="model">payment.transaction</field>
|
||||||
|
<field name="inherit_id" ref="payment.transaction_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//group[@string='Message']" position="before">
|
||||||
|
<field name="folio_ids" />
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user