fix: swap debit/credit for Receive type Journal Entry

For Receive transactions, paid_to (bank account) should be debited
and paid_from (income/receivable account) should be credited.
The logic was inverted in both bank_api.py and mapping.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ali 2026-03-16 14:57:05 +04:00
parent 3202f5e1ac
commit f063c5cd0c
2 changed files with 6 additions and 6 deletions

View File

@ -1674,14 +1674,14 @@ def _import_one_transaction(txn_data, settings, purpose_rules, purpose_threshold
else:
je.append("accounts", {
"account": paid_from,
"debit_in_account_currency": amount,
"credit_in_account_currency": amount,
"party_type": pf_party[0],
"party": pf_party[1],
**je_row_extra,
})
je.append("accounts", {
"account": paid_to,
"credit_in_account_currency": amount,
"debit_in_account_currency": amount,
"party_type": pt_party[0],
"party": pt_party[1],
**je_row_extra,

View File

@ -458,14 +458,14 @@ def _create_journal_entry_for_brt(txn, paid_from, paid_to, bank_txn, multi_curre
from_row = {
"account": paid_from,
"exchange_rate": from_rate,
"debit_in_account_currency": from_amount,
"credit_in_account_currency": 0,
"credit_in_account_currency": from_amount,
"debit_in_account_currency": 0,
}
to_row = {
"account": paid_to,
"exchange_rate": to_rate,
"credit_in_account_currency": to_amount,
"debit_in_account_currency": 0,
"debit_in_account_currency": to_amount,
"credit_in_account_currency": 0,
}
if party_type and party: