From c302d066a3528c48ada9dc62df4e67f1c10b8d53 Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Fri, 29 May 2020 10:19:58 +0530 Subject: [PATCH] fix: only save end date when transactions are returned (#22023) --- .../doctype/plaid_settings/plaid_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py index a45c6b13910..c3371ed5dfb 100644 --- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py +++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py @@ -141,12 +141,12 @@ def sync_transactions(bank, bank_account): result += new_bank_transaction(transaction) if result: - end_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date') + 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", end_date) + frappe.db.set_value("Bank Account", bank_account, "last_integration_date", last_transaction_date) except Exception: frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error"))