diff --git a/kapital_bank/mapping.py b/kapital_bank/mapping.py index 9e34594..03ee90c 100644 --- a/kapital_bank/mapping.py +++ b/kapital_bank/mapping.py @@ -459,12 +459,11 @@ def _create_journal_entry_for_brt(txn, paid_from, paid_to, bank_txn, multi_curre is_multi = from_currency != company_currency or to_currency != company_currency currency_precision = cint(frappe.db.get_single_value("System Settings", "currency_precision") or 2) - # Use currency from: mapping row → txn dict → bank transaction currency → company currency - # NOTE: use bank_txn.currency (= GL account currency, matches the BT amount), - # NOT kb_currency (= the foreign currency from the bank API, may differ from BT amount). + # txn_currency = the currency the BT amount is denominated in. + # mapping_currency is a FILTER (which transactions this rule matches), NOT the amount's currency. + # bank_txn.currency = GL account currency = currency of deposit/withdrawal = correct. txn_currency = ( - mapping_currency - or txn.get("currency") + txn.get("currency") or (getattr(bank_txn, "currency", None) or "") or company_currency ).strip()