mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
refactor: abort processing of all tasks upon cancellation
(cherry picked from commit 090e155fd0)
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Queued\nRunning\nCompleted"
|
"options": "Queued\nRunning\nCompleted\nCancelled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-10-20 08:06:26.786490",
|
"modified": "2025-10-20 12:06:32.613247",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Period Closing Voucher",
|
"name": "Process Period Closing Voucher",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class ProcessPeriodClosingVoucher(Document):
|
|||||||
normal_balances: DF.Table[ProcessPeriodClosingVoucherDetail]
|
normal_balances: DF.Table[ProcessPeriodClosingVoucherDetail]
|
||||||
p_l_closing_balance: DF.JSON | None
|
p_l_closing_balance: DF.JSON | None
|
||||||
parent_pcv: DF.Link
|
parent_pcv: DF.Link
|
||||||
status: DF.Literal["Queued", "Running", "Completed"]
|
status: DF.Literal["Queued", "Running", "Completed", "Cancelled"]
|
||||||
z_opening_balances: DF.Table[ProcessPeriodClosingVoucherDetail]
|
z_opening_balances: DF.Table[ProcessPeriodClosingVoucherDetail]
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
@@ -84,6 +84,9 @@ class ProcessPeriodClosingVoucher(Document):
|
|||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
start_pcv_processing(self.name)
|
start_pcv_processing(self.name)
|
||||||
|
|
||||||
|
def on_cancel(self):
|
||||||
|
cancel_pcv_processing(self.name)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def start_pcv_processing(docname: str):
|
def start_pcv_processing(docname: str):
|
||||||
@@ -142,6 +145,20 @@ def pause_pcv_processing(docname: str):
|
|||||||
qb.update(ppcvd).set(ppcvd.status, "Paused").where(ppcvd.name.isin(queued_dates)).run()
|
qb.update(ppcvd).set(ppcvd.status, "Paused").where(ppcvd.name.isin(queued_dates)).run()
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def cancel_pcv_processing(docname: str):
|
||||||
|
ppcv = qb.DocType("Process Period Closing Voucher")
|
||||||
|
qb.update(ppcv).set(ppcv.status, "Cancelled").where(ppcv.name.eq(docname)).run()
|
||||||
|
|
||||||
|
if queued_dates := frappe.db.get_all(
|
||||||
|
"Process Period Closing Voucher Detail",
|
||||||
|
filters={"parent": docname, "status": "Queued"},
|
||||||
|
pluck="name",
|
||||||
|
):
|
||||||
|
ppcvd = qb.DocType("Process Period Closing Voucher Detail")
|
||||||
|
qb.update(ppcvd).set(ppcvd.status, "Cancelled").where(ppcvd.name.isin(queued_dates)).run()
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def resume_pcv_processing(docname: str):
|
def resume_pcv_processing(docname: str):
|
||||||
ppcv = qb.DocType("Process Period Closing Voucher")
|
ppcv = qb.DocType("Process Period Closing Voucher")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"options": "Queued\nRunning\nPaused\nCompleted"
|
"options": "Queued\nRunning\nPaused\nCompleted\nCancelled"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "closing_balance",
|
"fieldname": "closing_balance",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-10-17 11:28:34.775743",
|
"modified": "2025-10-20 12:03:59.106931",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Period Closing Voucher Detail",
|
"name": "Process Period Closing Voucher Detail",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ProcessPeriodClosingVoucherDetail(Document):
|
|||||||
parenttype: DF.Data
|
parenttype: DF.Data
|
||||||
processing_date: DF.Date | None
|
processing_date: DF.Date | None
|
||||||
report_type: DF.Literal["Profit and Loss", "Balance Sheet"]
|
report_type: DF.Literal["Profit and Loss", "Balance Sheet"]
|
||||||
status: DF.Literal["Queued", "Running", "Paused", "Completed"]
|
status: DF.Literal["Queued", "Running", "Paused", "Completed", "Cancelled"]
|
||||||
# end: auto-generated types
|
# end: auto-generated types
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user