refactor: more data structure changes

(cherry picked from commit a15578f8f4)
This commit is contained in:
ruthra kumar
2025-10-03 11:17:29 +05:30
committed by Mergify
parent bfc0044d23
commit 902ce45a36
3 changed files with 27 additions and 9 deletions

View File

@@ -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:

View File

@@ -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",

View File

@@ -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