Skip to content

fix: Enhance cron jobs and have an outside report button on sales invoice#156

Merged
maniamartial merged 2 commits into
developfrom
fix/cron
May 4, 2026
Merged

fix: Enhance cron jobs and have an outside report button on sales invoice#156
maniamartial merged 2 commits into
developfrom
fix/cron

Conversation

@maniamartial

@maniamartial maniamartial commented May 4, 2026

Copy link
Copy Markdown
Contributor
  • send_multiple_signed_compliance_invoices_to_zatca (still the method registered on Scheduled Job Type) now only frappe.enqueues the real work.
  • _run_send_multiple_signed_compliance_invoices_to_zatca holds 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=True with job_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.

@maniamartial maniamartial merged commit 889c491 into develop May 4, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant