Codacy corrections + sql queries

This commit is contained in:
Charles-Henri Decultot
2018-12-12 17:45:22 +00:00
parent 57c6b49d1a
commit 6a4dae3a9d
15 changed files with 32 additions and 43 deletions

View File

@@ -5,7 +5,6 @@
from __future__ import unicode_literals
import frappe
from frappe import _
import json
import requests
from plaid import Client
from plaid.errors import APIError, ItemError
@@ -34,7 +33,7 @@ class PlaidConnector():
def get_access_token(self, public_token):
if public_token is None:
frappe.log_error(_("Public token is missing for this bank"), _("Plaid public token error"))
response = self.client.Item.public_token.exchange(public_token)
access_token = response['access_token']
@@ -68,10 +67,10 @@ class PlaidConnector():
account_ids = [account_id]
response = self.client.Transactions.get(self.access_token, start_date=start_date, end_date=end_date, account_ids=account_ids)
else:
response = self.client.Transactions.get(self.access_token, start_date=start_date, end_date=end_date)
transactions = response['transactions']
while len(transactions) < response['total_transactions']:

View File

@@ -2,11 +2,7 @@
// For license information, please see license.txt
frappe.ui.form.on('Plaid Settings', {
refresh: function(frm) {
},
connect_btn: function(frm) {
connect_btn: function() {
frappe.set_route('bank-reconciliation');
}
});

View File

@@ -83,7 +83,7 @@ def add_bank_accounts(response, bank, company):
result.append(new_account.name)
except frappe.UniqueValidationError as e:
except frappe.UniqueValidationError:
frappe.msgprint(_("Bank account {0} already exists and could not be created again").format(new_account.account_name))
except Exception:
frappe.throw(frappe.get_traceback())
@@ -99,7 +99,7 @@ def add_account_type(account_type):
"doctype": "Account Type",
"account_type": account_type
}).insert()
except:
except Exception:
frappe.throw(frappe.get_traceback())

View File

@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestPlaidSettings(unittest.TestCase):