Codacy corrections

This commit is contained in:
Charles-Henri Decultot 2018-06-20 18:52:31 +00:00
parent bbed5d41ca
commit 19a47c3e0a
4 changed files with 17 additions and 18 deletions

View File

@ -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");
}
});
}
}
});
}
});

View File

@ -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)))

View File

@ -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');
}
})
});

View File

@ -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