mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-12 22:21:50 +00:00
feat(accounts): add configurable job timeout for Process Period Closing Voucher
Adds a `pcv_job_timeout` Int field (default 3600s) to Accounts Settings
so admins can tune the enqueue timeout for PCV background jobs without
a code change. All three `frappe.enqueue` calls in
`process_period_closing_voucher.py` now read this value at runtime.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 13b6c4a165)
# Conflicts:
# erpnext/accounts/doctype/accounts_settings/accounts_settings.json
This commit is contained in:
@@ -79,6 +79,7 @@
|
|||||||
"acc_frozen_upto",
|
"acc_frozen_upto",
|
||||||
"ignore_account_closing_balance",
|
"ignore_account_closing_balance",
|
||||||
"use_legacy_controller_for_pcv",
|
"use_legacy_controller_for_pcv",
|
||||||
|
"pcv_job_timeout",
|
||||||
"column_break_25",
|
"column_break_25",
|
||||||
"frozen_accounts_modifier",
|
"frozen_accounts_modifier",
|
||||||
"tab_break_dpet",
|
"tab_break_dpet",
|
||||||
@@ -635,6 +636,7 @@
|
|||||||
"label": "Use Legacy Controller For Period Closing Voucher"
|
"label": "Use Legacy Controller For Period Closing Voucher"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
"fieldname": "payment_entry_settings",
|
"fieldname": "payment_entry_settings",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Payment Entry Settings"
|
"label": "Payment Entry Settings"
|
||||||
@@ -650,6 +652,20 @@
|
|||||||
"fieldname": "show_party_balance",
|
"fieldname": "show_party_balance",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Show Party Balance"
|
"label": "Show Party Balance"
|
||||||
|
=======
|
||||||
|
"default": "3600",
|
||||||
|
"description": "Timeout (in seconds) for each background job enqueued by Process Period Closing Voucher",
|
||||||
|
"fieldname": "pcv_job_timeout",
|
||||||
|
"fieldtype": "Int",
|
||||||
|
"label": "PCV Job Timeout (seconds)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Users with this role will be notified if the asset depreciation gets failed",
|
||||||
|
"fieldname": "role_to_notify_on_depreciation_failure",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Role to Notify on Depreciation Failure",
|
||||||
|
"options": "Role"
|
||||||
|
>>>>>>> 13b6c4a165 (feat(accounts): add configurable job timeout for Process Period Closing Voucher)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "30, 60, 90, 120",
|
"default": "30, 60, 90, 120",
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ def start_pcv_processing(docname: str):
|
|||||||
frappe.has_permission("Process Payment Reconciliation", "write", doc=docname, throw=True)
|
frappe.has_permission("Process Payment Reconciliation", "write", doc=docname, throw=True)
|
||||||
frappe.db.set_value("Process Period Closing Voucher", docname, "status", "Running")
|
frappe.db.set_value("Process Period Closing Voucher", docname, "status", "Running")
|
||||||
|
|
||||||
|
timeout = frappe.db.get_single_value("Accounts Settings", "pcv_job_timeout") or 3600
|
||||||
|
|
||||||
ppcvd = qb.DocType("Process Period Closing Voucher Detail")
|
ppcvd = qb.DocType("Process Period Closing Voucher Detail")
|
||||||
if normal_balances := (
|
if normal_balances := (
|
||||||
qb.from_(ppcvd)
|
qb.from_(ppcvd)
|
||||||
@@ -118,7 +120,7 @@ def start_pcv_processing(docname: str):
|
|||||||
frappe.enqueue(
|
frappe.enqueue(
|
||||||
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date",
|
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date",
|
||||||
queue="long",
|
queue="long",
|
||||||
timeout="3600",
|
timeout=timeout,
|
||||||
is_async=True,
|
is_async=True,
|
||||||
enqueue_after_commit=True,
|
enqueue_after_commit=True,
|
||||||
docname=docname,
|
docname=docname,
|
||||||
@@ -244,6 +246,8 @@ def get_gle_for_closing_account(pcv, dimension_balance, dimensions):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def schedule_next_date(docname: str):
|
def schedule_next_date(docname: str):
|
||||||
|
timeout = frappe.db.get_single_value("Accounts Settings", "pcv_job_timeout") or 3600
|
||||||
|
|
||||||
ppcvd = qb.DocType("Process Period Closing Voucher Detail")
|
ppcvd = qb.DocType("Process Period Closing Voucher Detail")
|
||||||
if to_process := (
|
if to_process := (
|
||||||
qb.from_(ppcvd)
|
qb.from_(ppcvd)
|
||||||
@@ -269,7 +273,7 @@ def schedule_next_date(docname: str):
|
|||||||
frappe.enqueue(
|
frappe.enqueue(
|
||||||
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date",
|
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.process_individual_date",
|
||||||
queue="long",
|
queue="long",
|
||||||
timeout="3600",
|
timeout=timeout,
|
||||||
is_async=True,
|
is_async=True,
|
||||||
enqueue_after_commit=True,
|
enqueue_after_commit=True,
|
||||||
docname=docname,
|
docname=docname,
|
||||||
@@ -299,7 +303,7 @@ def schedule_next_date(docname: str):
|
|||||||
frappe.enqueue(
|
frappe.enqueue(
|
||||||
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.summarize_and_post_ledger_entries",
|
method="erpnext.accounts.doctype.process_period_closing_voucher.process_period_closing_voucher.summarize_and_post_ledger_entries",
|
||||||
queue="long",
|
queue="long",
|
||||||
timeout="3600",
|
timeout=timeout,
|
||||||
is_async=True,
|
is_async=True,
|
||||||
job_name=job_name,
|
job_name=job_name,
|
||||||
enqueue_after_commit=True,
|
enqueue_after_commit=True,
|
||||||
|
|||||||
Reference in New Issue
Block a user