From 4b1f16542952563f13f9eb716604d763a35bf54c Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:34:15 +0530 Subject: [PATCH] fix: Use reverse debit and credit to get net amount in GL Entries (#27174) * fix: Use reverse debit and credit to get net amount in GL Entries * fix: Remove unused import --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index abacee985c..5a183e2e51 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -755,9 +755,11 @@ class PaymentEntry(AccountsController): if self.payment_type in ('Pay', 'Internal Transfer'): dr_or_cr = "debit" if d.add_deduct_tax == "Add" else "credit" + rev_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit" against = self.party or self.paid_from elif self.payment_type == 'Receive': dr_or_cr = "credit" if d.add_deduct_tax == "Add" else "debit" + rev_dr_or_cr = "credit" if dr_or_cr == "debit" else "debit" against = self.party or self.paid_to payment_or_advance_account = self.get_party_account_for_taxes() @@ -779,14 +781,13 @@ class PaymentEntry(AccountsController): "cost_center": d.cost_center }, account_currency, item=d)) - #Intentionally use -1 to get net values in party account if not d.included_in_paid_amount or self.advance_tax_account: gl_entries.append( self.get_gl_dict({ "account": payment_or_advance_account, "against": against, - dr_or_cr: -1 * tax_amount, - dr_or_cr + "_in_account_currency": -1 * base_tax_amount + rev_dr_or_cr: tax_amount, + rev_dr_or_cr + "_in_account_currency": -1 * base_tax_amount if account_currency==self.company_currency else d.tax_amount, "cost_center": self.cost_center,