diff --git a/pms/controllers/pms_portal.py b/pms/controllers/pms_portal.py index 2e4f7c9a0..be57179ff 100644 --- a/pms/controllers/pms_portal.py +++ b/pms/controllers/pms_portal.py @@ -93,6 +93,10 @@ class PortalFolio(CustomerPortal): "success_url", "%s?%s" % (folio_sudo.access_url, access_token if access_token else ""), ) + custom_amount = False + if "custom_amount" in kwargs: + custom_amount = float(kwargs["custom_amount"]) + vals = { "acquirer_id": acquirer_id, "return_url": success_url, @@ -118,6 +122,7 @@ class PortalFolio(CustomerPortal): "subscription payments will be made automatically." ), }, + amount=custom_amount, ) @http.route( @@ -199,6 +204,8 @@ class PortalFolio(CustomerPortal): download=download, ) values = self._folio_get_page_view_values(folio_sudo, access_token, **kw) + if "custom_amount" in kw: + values["custom_amount"] = float(kw["custom_amount"]) return request.render("pms.folio_portal_template", values) diff --git a/pms/models/payment_transaction.py b/pms/models/payment_transaction.py index 91ecdcbd8..4b1018131 100644 --- a/pms/models/payment_transaction.py +++ b/pms/models/payment_transaction.py @@ -22,7 +22,9 @@ class PaymentTransaction(models.Model): add_payment_vals["folio_ids"] = [(6, 0, self.folio_ids.ids)] return super(PaymentTransaction, self)._create_payment(add_payment_vals) - def render_folio_button(self, folio, submit_txt=None, render_values=None): + def render_folio_button( + self, folio, submit_txt=None, render_values=None, custom_amount=None + ): values = { "partner_id": folio.partner_id.id, "type": self.type, @@ -36,7 +38,7 @@ class PaymentTransaction(models.Model): .sudo() .render( self.reference, - folio.pending_amount, + custom_amount or folio.pending_amount, folio.currency_id.id, values=values, ) diff --git a/pms/views/folio_portal_templates.xml b/pms/views/folio_portal_templates.xml index 2f7b22801..d3c5859a2 100644 --- a/pms/views/folio_portal_templates.xml +++ b/pms/views/folio_portal_templates.xml @@ -78,7 +78,7 @@