Merge pull request #37718 from frappe/mergify/bp/version-15-hotfix/pr-37690
fix(plaid): Do not sync pending transactions (#37690)
This commit is contained in:
		
						commit
						2ba5bb8abc
					
				| @ -89,7 +89,6 @@ class BankTransaction(StatusUpdater): | |||||||
| 		    - 0 > a: Error: already over-allocated | 		    - 0 > a: Error: already over-allocated | ||||||
| 		- clear means: set the latest transaction date as clearance date | 		- clear means: set the latest transaction date as clearance date | ||||||
| 		""" | 		""" | ||||||
| 		gl_bank_account = frappe.db.get_value("Bank Account", self.bank_account, "account") |  | ||||||
| 		remaining_amount = self.unallocated_amount | 		remaining_amount = self.unallocated_amount | ||||||
| 		for payment_entry in self.payment_entries: | 		for payment_entry in self.payment_entries: | ||||||
| 			if payment_entry.allocated_amount == 0.0: | 			if payment_entry.allocated_amount == 0.0: | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ import frappe | |||||||
| from frappe import _ | from frappe import _ | ||||||
| from frappe.desk.doctype.tag.tag import add_tag | from frappe.desk.doctype.tag.tag import add_tag | ||||||
| from frappe.model.document import Document | from frappe.model.document import Document | ||||||
| from frappe.utils import add_months, formatdate, getdate, today | from frappe.utils import add_months, formatdate, getdate, sbool, today | ||||||
| from plaid.errors import ItemError | from plaid.errors import ItemError | ||||||
| 
 | 
 | ||||||
| from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account | from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account | ||||||
| @ -237,8 +237,6 @@ def new_bank_transaction(transaction): | |||||||
| 		deposit = abs(amount) | 		deposit = abs(amount) | ||||||
| 		withdrawal = 0.0 | 		withdrawal = 0.0 | ||||||
| 
 | 
 | ||||||
| 	status = "Pending" if transaction["pending"] == True else "Settled" |  | ||||||
| 
 |  | ||||||
| 	tags = [] | 	tags = [] | ||||||
| 	if transaction["category"]: | 	if transaction["category"]: | ||||||
| 		try: | 		try: | ||||||
| @ -247,13 +245,14 @@ def new_bank_transaction(transaction): | |||||||
| 		except KeyError: | 		except KeyError: | ||||||
| 			pass | 			pass | ||||||
| 
 | 
 | ||||||
| 	if not frappe.db.exists("Bank Transaction", dict(transaction_id=transaction["transaction_id"])): | 	if not frappe.db.exists( | ||||||
|  | 		"Bank Transaction", dict(transaction_id=transaction["transaction_id"]) | ||||||
|  | 	) and not sbool(transaction["pending"]): | ||||||
| 		try: | 		try: | ||||||
| 			new_transaction = frappe.get_doc( | 			new_transaction = frappe.get_doc( | ||||||
| 				{ | 				{ | ||||||
| 					"doctype": "Bank Transaction", | 					"doctype": "Bank Transaction", | ||||||
| 					"date": getdate(transaction["date"]), | 					"date": getdate(transaction["date"]), | ||||||
| 					"status": status, |  | ||||||
| 					"bank_account": bank_account, | 					"bank_account": bank_account, | ||||||
| 					"deposit": deposit, | 					"deposit": deposit, | ||||||
| 					"withdrawal": withdrawal, | 					"withdrawal": withdrawal, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user