refactor: dr/cr logic for journals as payments

(cherry picked from commit 0567243772)
This commit is contained in:
ruthra kumar
2023-07-12 06:14:17 +05:30
committed by Mergify
parent 197e5881aa
commit 8be312b73e

View File

@@ -986,15 +986,14 @@ class AccountsController(TransactionBase):
"Account", party_account, "account_currency"
)
dr_or_cr = "debit" if arg.get("party_type") == "Customer" else "credit"
# if arg.reference_doctype == "Purchase Invoice":
# dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
if arg.get("difference_amount") > 0:
dr_or_cr = "debit" if arg.get("party_type") == "Customer" else "credit"
else:
dr_or_cr = "credit" if arg.get("party_type") == "Customer" else "debit"
reverse_dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
gain_loss_account = arg.get("difference_account")
if not gain_loss_account:
frappe.throw(
_("Please set default Exchange Gain/Loss Account in Company {}").format(