mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 16:21:19 +00:00
Merge branch 'v11-pre-release' into version-11
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '11.1.76'
|
__version__ = '11.1.77'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -114,10 +114,11 @@ def add_account_subtype(account_subtype):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def sync_transactions(bank, bank_account):
|
def sync_transactions(bank, bank_account):
|
||||||
|
'''Sync transactions based on the last integration date as the start date, after sync is completed
|
||||||
last_sync_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date")
|
add the transaction date of the oldest transaction as the last integration date'''
|
||||||
if last_sync_date:
|
last_transaction_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date")
|
||||||
start_date = formatdate(last_sync_date, "YYYY-MM-dd")
|
if last_transaction_date:
|
||||||
|
start_date = formatdate(last_transaction_date, "YYYY-MM-dd")
|
||||||
else:
|
else:
|
||||||
start_date = formatdate(add_months(today(), -12), "YYYY-MM-dd")
|
start_date = formatdate(add_months(today(), -12), "YYYY-MM-dd")
|
||||||
end_date = formatdate(today(), "YYYY-MM-dd")
|
end_date = formatdate(today(), "YYYY-MM-dd")
|
||||||
@@ -125,13 +126,17 @@ def sync_transactions(bank, bank_account):
|
|||||||
try:
|
try:
|
||||||
transactions = get_transactions(bank=bank, bank_account=bank_account, start_date=start_date, end_date=end_date)
|
transactions = get_transactions(bank=bank, bank_account=bank_account, start_date=start_date, end_date=end_date)
|
||||||
result = []
|
result = []
|
||||||
if transactions:
|
for transaction in reversed(transactions):
|
||||||
for transaction in transactions:
|
result += new_bank_transaction(transaction)
|
||||||
result.append(new_bank_transaction(transaction))
|
|
||||||
|
|
||||||
frappe.db.set_value("Bank Account", bank_account, "last_integration_date", getdate(end_date))
|
if result:
|
||||||
|
last_transaction_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date')
|
||||||
|
|
||||||
|
frappe.logger().info("Plaid added {} new Bank Transactions from '{}' between {} and {}".format(
|
||||||
|
len(result), bank_account, start_date, end_date))
|
||||||
|
|
||||||
|
frappe.db.set_value("Bank Account", bank_account, "last_integration_date", last_transaction_date)
|
||||||
|
|
||||||
return result
|
|
||||||
except Exception:
|
except Exception:
|
||||||
frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error"))
|
frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error"))
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
frappe
|
frappe
|
||||||
unidecode
|
Unidecode==1.1.1
|
||||||
pygithub
|
PyGithub==1.45
|
||||||
googlemaps
|
googlemaps==4.2.0
|
||||||
python-stdnum
|
python-stdnum==1.13
|
||||||
braintree
|
braintree==3.59.0;python_version<"3.6"
|
||||||
gocardless_pro
|
braintree==4.0.0;python_version>="3.6"
|
||||||
woocommerce
|
gocardless-pro==1.16.0
|
||||||
pandas
|
WooCommerce==2.1.1
|
||||||
plaid-python
|
pandas==0.24.2
|
||||||
|
plaid-python==3.7.0
|
||||||
|
|||||||
Reference in New Issue
Block a user