From 902ce45a36267c8caf404b15efa00029f70ea7ef Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 3 Oct 2025 11:17:29 +0530 Subject: [PATCH] refactor: more data structure changes (cherry picked from commit a15578f8f47134c3efec451647934d92a80fce4c) --- .../period_closing_voucher.py | 16 +++++++++++----- .../process_period_closing_voucher.json | 18 ++++++++++++++---- .../process_period_closing_voucher.py | 2 ++ 3 files changed, 27 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 fba261a1484..97c503f5885 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,11 @@ 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") - self.make_gl_entries() + 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: + print("submit") def on_cancel(self): self.ignore_linked_doctypes = ( @@ -141,9 +144,12 @@ class PeriodClosingVoucher(AccountsController): "Payment Ledger Entry", "Account Closing Balance", ) - self.block_if_future_closing_voucher_exists() - self.db_set("gle_processing_status", "In Progress") - self.cancel_gl_entries() + if frappe.get_single_value("Accounts Settings", "use_legacy_controller_for_pcv"): + self.block_if_future_closing_voucher_exists() + self.db_set("gle_processing_status", "In Progress") + self.cancel_gl_entries() + else: + print("cancel") 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.json b/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.json index 0c1c7a996cf..5368138a52b 100644 --- a/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.json +++ b/erpnext/accounts/doctype/process_period_closing_voucher/process_period_closing_voucher.json @@ -5,18 +5,28 @@ "doctype": "DocType", "engine": "InnoDB", "field_order": [ - "section_break_zqqu" + "parent_pcv", + "status" ], "fields": [ { - "fieldname": "section_break_zqqu", - "fieldtype": "Section Break" + "fieldname": "parent_pcv", + "fieldtype": "Link", + "label": "PCV", + "options": "Period Closing Voucher" + }, + { + "default": "Queued", + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "options": "Queued\nRunning\nCompleted" } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-09-25 15:44:03.534699", + "modified": "2025-10-01 15:57:36.832943", "modified_by": "Administrator", "module": "Accounts", "name": "Process Period Closing Voucher", 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 da38291b16c..784ae36ae2f 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 @@ -14,6 +14,8 @@ class ProcessPeriodClosingVoucher(Document): if TYPE_CHECKING: from frappe.types import DF + parent_pcv: DF.Link | None + status: DF.Literal["Queued", "Running", "Completed"] # end: auto-generated types pass