fix: Enhance cron jobs and have an outside report button on sales invoice#156
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
send_multiple_signed_compliance_invoices_to_zatca(still the method registered on Scheduled Job Type) now onlyfrappe.enqueues the real work._run_send_multiple_signed_compliance_invoices_to_zatcaholds the previous logic (loop companies → invoices →bg_generate_einvoice), runs in a worker, and ends naturally when there is nothing left to process (same as before, just not on the scheduler process).Worker settings
queue="long"– use the long worker so jobs are not stuck on the default queue.timeout=1800(30 minutes) – passed explicitly so the job can run up to 30 minutes even though Frappe’s default long queue timeout is 25 minutes (1500 s).deduplicate=Truewithjob_id="zatca_integration:b2c_compliance_batch_submit"– if the scheduler fires again while a batch is queued or running, Frappe will not enqueue a second copy (avoids overlapping batches).onload: inner button “ZATCA Report” on the list page (same bar as other list actions).Uses row checkboxes →
get_checked_items(true)for names.Asks for confirmation, freezes the screen with “Reporting to ZATCA…”, calls the bulk method, then shows a wide summary (Succeeded / Skipped / Failed) and refreshes the list.