mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-26 18:18:30 +00:00
fix: incorrect exc gain/loss for PE against JE for payable accounts
(cherry picked from commit 81b574053f)
This commit is contained in:
@@ -1437,7 +1437,8 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
dr_or_cr = "debit" if d.exchange_gain_loss > 0 else "credit"
|
dr_or_cr = "debit" if d.exchange_gain_loss > 0 else "credit"
|
||||||
|
|
||||||
if d.reference_doctype == "Purchase Invoice":
|
# Inverse debit/credit for payable accounts
|
||||||
|
if self.is_payable_account(d.reference_doctype, party_account):
|
||||||
dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
|
dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
|
||||||
|
|
||||||
reverse_dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
|
reverse_dr_or_cr = "debit" if dr_or_cr == "credit" else "credit"
|
||||||
@@ -1471,6 +1472,14 @@ class AccountsController(TransactionBase):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def is_payable_account(self, reference_doctype, account):
|
||||||
|
if reference_doctype == "Purchase Invoice" or (
|
||||||
|
reference_doctype == "Journal Entry"
|
||||||
|
and frappe.get_cached_value("Account", account, "account_type") == "Payable"
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def update_against_document_in_jv(self):
|
def update_against_document_in_jv(self):
|
||||||
"""
|
"""
|
||||||
Links invoice and advance voucher:
|
Links invoice and advance voucher:
|
||||||
|
|||||||
Reference in New Issue
Block a user