From 18eea3425c0e29f9a940861820413dbe57e0adfe Mon Sep 17 00:00:00 2001 From: venkat102 Date: Tue, 15 Jul 2025 18:24:54 +0530 Subject: [PATCH] fix(period closing voucher): closing account head debit and debit in account currency should be equal (cherry picked from commit 76a233e1b7e995b8d0d56332b33c2507cd7fe392) --- .../period_closing_voucher.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py index 5119562382f..24ba4af5482 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -206,6 +206,9 @@ class PeriodClosingVoucher(AccountsController): return gl_entry def get_gle_for_closing_account(self, acc): + debit = abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0 + credit = abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) < 0 else 0 + gl_entry = self.get_gl_dict( { "company": self.company, @@ -214,16 +217,10 @@ class PeriodClosingVoucher(AccountsController): "cost_center": acc.cost_center, "finance_book": acc.finance_book, "account_currency": acc.account_currency, - "debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) - if flt(acc.bal_in_account_currency) > 0 - else 0, - "debit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0, - "credit_in_account_currency": abs(flt(acc.bal_in_account_currency)) - if flt(acc.bal_in_account_currency) < 0 - else 0, - "credit": abs(flt(acc.bal_in_company_currency)) - if flt(acc.bal_in_company_currency) < 0 - else 0, + "debit_in_account_currency": debit, + "debit": debit, + "credit_in_account_currency": credit, + "credit": credit, "is_period_closing_voucher_entry": 1, }, item=acc,