mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 19:19:17 +00:00
Merge pull request #40494 from ruthra-kumar/bank_statement_import_error
fix: AttributeError in Bank Statement Import
This commit is contained in:
@@ -149,6 +149,9 @@ def start_import(
|
|||||||
import_file = ImportFile("Bank Transaction", file=file, import_type="Insert New Records")
|
import_file = ImportFile("Bank Transaction", file=file, import_type="Insert New Records")
|
||||||
|
|
||||||
data = parse_data_from_template(import_file.raw_data)
|
data = parse_data_from_template(import_file.raw_data)
|
||||||
|
# Importer expects 'Data Import' class, which has 'payload_count' attribute
|
||||||
|
if not data_import.get("payload_count"):
|
||||||
|
data_import.payload_count = len(data) - 1
|
||||||
|
|
||||||
if import_file_path:
|
if import_file_path:
|
||||||
add_bank_account(data, bank_account)
|
add_bank_account(data, bank_account)
|
||||||
|
|||||||
@@ -56,17 +56,17 @@ class BankTransaction(Document):
|
|||||||
Bank Transaction should be on the same currency as the Bank Account.
|
Bank Transaction should be on the same currency as the Bank Account.
|
||||||
"""
|
"""
|
||||||
if self.currency and self.bank_account:
|
if self.currency and self.bank_account:
|
||||||
account = frappe.get_cached_value("Bank Account", self.bank_account, "account")
|
if account := frappe.get_cached_value("Bank Account", self.bank_account, "account"):
|
||||||
account_currency = frappe.get_cached_value("Account", account, "account_currency")
|
account_currency = frappe.get_cached_value("Account", account, "account_currency")
|
||||||
|
|
||||||
if self.currency != account_currency:
|
if self.currency != account_currency:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Transaction currency: {0} cannot be different from Bank Account({1}) currency: {2}"
|
"Transaction currency: {0} cannot be different from Bank Account({1}) currency: {2}"
|
||||||
).format(
|
).format(
|
||||||
frappe.bold(self.currency), frappe.bold(self.bank_account), frappe.bold(account_currency)
|
frappe.bold(self.currency), frappe.bold(self.bank_account), frappe.bold(account_currency)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
def set_status(self):
|
def set_status(self):
|
||||||
if self.docstatus == 2:
|
if self.docstatus == 2:
|
||||||
|
|||||||
Reference in New Issue
Block a user