From 98bd880c73024a79b56c9956e56c278332ca6e24 Mon Sep 17 00:00:00 2001 From: venkat102 Date: Tue, 15 Jul 2025 17:38:37 +0530 Subject: [PATCH] fix(period closing voucher): closing account head debit and debit in account currency should be equal (cherry picked from commit d6fd6132724b9317b64de9d6b96ce813ab6e40cb) --- .../period_closing_voucher.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 2d065632419..7f51f2add59 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -210,8 +210,10 @@ class PeriodClosingVoucher(AccountsController): return gl_entry def get_gle_for_closing_account(self, dimension_balance, dimensions): - balance_in_account_currency = flt(dimension_balance.balance_in_account_currency) balance_in_company_currency = flt(dimension_balance.balance_in_company_currency) + debit = balance_in_company_currency if balance_in_company_currency > 0 else 0 + credit = abs(balance_in_company_currency) if balance_in_company_currency < 0 else 0 + gl_entry = frappe._dict( { "company": self.company, @@ -220,14 +222,10 @@ class PeriodClosingVoucher(AccountsController): "account_currency": frappe.db.get_value( "Account", self.closing_account_head, "account_currency" ), - "debit_in_account_currency": balance_in_account_currency - if balance_in_account_currency > 0 - else 0, - "debit": balance_in_company_currency if balance_in_company_currency > 0 else 0, - "credit_in_account_currency": abs(balance_in_account_currency) - if balance_in_account_currency < 0 - else 0, - "credit": abs(balance_in_company_currency) if balance_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, "voucher_type": "Period Closing Voucher", "voucher_no": self.name,