diff --git a/erpnext/accounts/doctype/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js index 90042cbbb32..9ecce18e7eb 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.js +++ b/erpnext/accounts/doctype/payment_request/payment_request.js @@ -50,19 +50,19 @@ frappe.ui.form.on("Payment Request", "refresh", function(frm) { }); frappe.ui.form.on("Payment Request", "is_a_subscription", function(frm) { - frm.toggle_reqd("payment_gateway_account", frm.doc.is_a_subscription); - frm.toggle_reqd("subscription_plans", frm.doc.is_a_subscription); + frm.toggle_reqd("payment_gateway_account", frm.doc.is_a_subscription); + frm.toggle_reqd("subscription_plans", frm.doc.is_a_subscription); - if (frm.doc.is_a_subscription) { - frappe.call({ - method: "get_subscription_details", - doc: frm.doc, - freeze: true, - callback: function(r){ - if(!r.exc) { - frm.refresh_field("subscription_plans"); - } + if (frm.doc.is_a_subscription) { + frappe.call({ + method: "get_subscription_details", + doc: frm.doc, + freeze: true, + callback: function(r){ + if(!r.exc) { + frm.refresh_field("subscription_plans"); } - }); - } + } + }); + } }); diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py index 8af0bcc7288..a1fdb85d97c 100644 --- a/erpnext/accounts/doctype/payment_request/payment_request.py +++ b/erpnext/accounts/doctype/payment_request/payment_request.py @@ -14,7 +14,7 @@ from frappe.integrations.utils import get_payment_gateway_controller from frappe.utils.background_jobs import enqueue from erpnext.erpnext_integrations.stripe_integration import create_stripe_subscription -class PaymentRequest(Document): +class PaymentRequest(Document): def validate(self): self.validate_reference_document() self.validate_payment_request() @@ -47,9 +47,9 @@ class PaymentRequest(Document): rate = plan.get_plan_rate() frappe.log_error(rate) - + amount += rate - + if amount != self.grand_total: frappe.msgprint(_("The amount of {0} set in this payment request is different from the calculated amount of all payment plans: {1}. Make sure this is correct before submitting the document.".format(self.grand_total, amount))) diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan.js b/erpnext/accounts/doctype/subscription_plan/subscription_plan.js index 5a45c2caa28..aaa32cfe7ef 100644 --- a/erpnext/accounts/doctype/subscription_plan/subscription_plan.js +++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan.js @@ -6,4 +6,4 @@ frappe.ui.form.on('Subscription Plan', { frm.toggle_reqd("cost", frm.doc.price_determination === 'Fixed rate'); frm.toggle_reqd("price_list", frm.doc.price_determination === 'Based on price list'); } -}) \ No newline at end of file +}); \ No newline at end of file diff --git a/erpnext/erpnext_integrations/stripe_integration.py b/erpnext/erpnext_integrations/stripe_integration.py index c33adf90d8c..a3a88bb1ba9 100644 --- a/erpnext/erpnext_integrations/stripe_integration.py +++ b/erpnext/erpnext_integrations/stripe_integration.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -from frappe.model.document import Document import frappe from frappe import _ from frappe.integrations.utils import create_request_log