From 64be694087292f99c81d8550ee5987696ef615c4 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 1 May 2023 10:56:46 +0530 Subject: [PATCH] fix: Patch for posting closing balances (#35037) --- erpnext/patches/v14_0/update_closing_balances.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/v14_0/update_closing_balances.py b/erpnext/patches/v14_0/update_closing_balances.py index 40a18516cb..f47e730fd2 100644 --- a/erpnext/patches/v14_0/update_closing_balances.py +++ b/erpnext/patches/v14_0/update_closing_balances.py @@ -26,7 +26,15 @@ def execute(): pcv_doc.year_start_date = get_fiscal_year( pcv.posting_date, pcv.fiscal_year, company=pcv.company )[1] - gl_entries = pcv_doc.get_gl_entries() + + gl_entries = frappe.db.get_all( + "GL Entry", filters={"voucher_no": pcv.name, "is_cancelled": 0}, fields=["*"] + ) + for entry in gl_entries: + entry["is_period_closing_voucher_entry"] = 1 + entry["closing_date"] = pcv_doc.posting_date + entry["period_closing_voucher"] = pcv_doc.name + closing_entries = pcv_doc.get_grouped_gl_entries(get_opening_entries=get_opening_entries) make_closing_entries(gl_entries + closing_entries, voucher_name=pcv.name) company_wise_order[pcv.company].append(pcv.posting_date)