-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: allow users to configure interval for Semi-Auto payment rec…
…onciliation (#45211) * refactor: configurable interval for reconciliation trigger * refactor: set default value for interval * refactor: configurable queue size * refactor: use patch to setup default cron job * refactor: use 'after_migrate' to setup cron for reconciliation User specified interval will be used * chore: type casting * refactor: use scheduler_event to persist cron * chore: rename field * chore: use configured queue size * chore: remove unwanted field
- Loading branch information
1 parent
aea69af
commit ce9c606
Showing
7 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import frappe | ||
|
||
from erpnext.accounts.utils import sync_auto_reconcile_config | ||
|
||
|
||
def execute(): | ||
""" | ||
Set default Cron Interval and Queue size | ||
""" | ||
frappe.db.set_single_value("Accounts Settings", "auto_reconciliation_job_trigger", 15) | ||
frappe.db.set_single_value("Accounts Settings", "reconciliation_queue_size", 5) | ||
|
||
# Create Scheduler Event record if it doesn't exist | ||
method = "erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation.trigger_reconciliation_for_queued_docs" | ||
if not frappe.db.get_all( | ||
"Scheduler Event", {"scheduled_against": "Process Payment Reconciliation", "method": method} | ||
): | ||
frappe.get_doc( | ||
{ | ||
"doctype": "Scheduler Event", | ||
"scheduled_against": "Process Payment Reconciliation", | ||
"method": method, | ||
} | ||
).save() | ||
|
||
sync_auto_reconcile_config(15) |