From 178eded25909f51cc43151e4a8b8f342cef4aaec Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 3 Nov 2025 16:44:26 +0530 Subject: [PATCH] refactor: minor changes on status 1. set to 'In Progress' on start of both legacy and new controller 2. force delete to avoid permission issues 3. default to 1hr timeout (cherry picked from commit 9c13edc0b9e34c28a067871f260ebef866640558) --- .../doctype/period_closing_voucher/period_closing_voucher.py | 4 ++-- .../process_period_closing_voucher.py | 2 ++ 2 files changed, 4 insertions(+), 2 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 40ed4230a5c..210dbc5bbf5 100644 --- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py +++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py @@ -131,8 +131,8 @@ class PeriodClosingVoucher(AccountsController): frappe.throw(_("Currency of the Closing Account must be {0}").format(company_currency)) def on_submit(self): + self.db_set("gle_processing_status", "In Progress") if frappe.get_single_value("Accounts Settings", "use_legacy_controller_for_pcv"): - self.db_set("gle_processing_status", "In Progress") self.make_gl_entries() else: ppcv = frappe.get_doc({"doctype": "Process Period Closing Voucher", "parent_pcv": self.name}) @@ -165,7 +165,7 @@ class PeriodClosingVoucher(AccountsController): "Process Period Closing Voucher", {"parent_pcv": self.name, "docstatus": ["in", [1, 2]]} ) for x in ppcvs: - frappe.delete_doc("Process Period Closing Voucher", x.name) + frappe.delete_doc("Process Period Closing Voucher", x.name, force=True, ignore_permissions=True) def make_gl_entries(self): if frappe.db.estimate_count("GL Entry") > 100_000: diff --git a/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.py b/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.py index b52ac54b6b8..e6f9913dcb2 100644 --- a/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.py +++ b/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.py @@ -113,6 +113,7 @@ def start_pcv_processing(docname: str): frappe.enqueue( method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date", queue="long", + timeout="3600", is_async=True, enqueue_after_commit=True, docname=docname, @@ -256,6 +257,7 @@ def schedule_next_date(docname: str): frappe.enqueue( method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date", queue="long", + timeout="3600", is_async=True, enqueue_after_commit=True, docname=docname,