removed filter for multi currency
This commit is contained in:
parent
c563f494c3
commit
e54d13ae22
|
|
@ -1264,17 +1264,8 @@ def get_statement_transactions(from_date, to_date, account_iban, login_name=None
|
|||
.get("statementList", [])
|
||||
)
|
||||
|
||||
# Get currency of current account for cross-account filtering
|
||||
account_currency = frappe.db.get_value("Kapital Bank Account", account_iban, "currency") or ""
|
||||
|
||||
# Build IBAN → currency map for all local accounts (for cross-currency filtering)
|
||||
local_account_currencies = dict(
|
||||
frappe.db.get_all("Kapital Bank Account", fields=["name", "currency"], as_list=True)
|
||||
)
|
||||
|
||||
transactions = []
|
||||
skipped_duplicates = 0
|
||||
skipped_cross_currency = 0
|
||||
|
||||
for txn in statement_list:
|
||||
trn_ref = (txn.get("trnRefNo") or "").strip()
|
||||
|
|
@ -1303,14 +1294,6 @@ def get_statement_transactions(from_date, to_date, account_iban, login_name=None
|
|||
contr_name = contr_parts[1] if len(contr_parts) > 1 else ""
|
||||
contr_voen = contr_parts[2] if len(contr_parts) > 2 else ""
|
||||
|
||||
# Skip if counterparty account exists locally with a different currency
|
||||
# (that transaction belongs to the counterparty account's currency view)
|
||||
if contr_iban and contr_iban in local_account_currencies:
|
||||
contr_account_currency = local_account_currencies[contr_iban]
|
||||
if contr_account_currency and contr_account_currency != account_currency:
|
||||
skipped_cross_currency += 1
|
||||
continue
|
||||
|
||||
# Purpose
|
||||
purpose = (txn.get("purpose") or "").strip()
|
||||
|
||||
|
|
@ -1332,7 +1315,6 @@ def get_statement_transactions(from_date, to_date, account_iban, login_name=None
|
|||
"transactions": transactions,
|
||||
"total_fetched": len(statement_list),
|
||||
"skipped_duplicates": skipped_duplicates,
|
||||
"skipped_cross_currency": skipped_cross_currency,
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -2136,10 +2118,14 @@ def _import_one_bank_transaction(txn_data, settings, voen_to_party, name_to_part
|
|||
return {
|
||||
"success": False,
|
||||
"error_type": "unmapped_bank_account",
|
||||
"message": f"No bank account mapping for {source_display} with currency {currency}",
|
||||
"message": f"No bank account mapping for {source_display}",
|
||||
"txn_data": txn_data,
|
||||
}
|
||||
|
||||
# Use the bank account's own currency to avoid mismatch errors in Frappe
|
||||
ba_currency = frappe.db.get_value("Bank Account", bank_account, "account_currency") or currency
|
||||
currency = ba_currency
|
||||
|
||||
# Optional party mapping: VÖEN → name → None
|
||||
# C (credit, money in) → prefer Customer; D (debit, money out) → prefer Supplier
|
||||
def _resolve_party(candidates):
|
||||
|
|
|
|||
Loading…
Reference in New Issue