Skip to content

Commit

Permalink
fix: do not run bg job for single doc
Browse files Browse the repository at this point in the history
(cherry picked from commit 1856050)
  • Loading branch information
GursheenK authored and ruthra-kumar committed Oct 10, 2023
1 parent c9bcf79 commit 4123e7b
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,17 @@ def generate_preview(self):
return rendered_page

def on_submit(self):
job_name = "repost_accounting_ledger_" + self.name
frappe.enqueue(
method="erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger.start_repost",
account_repost_doc=self.name,
is_async=True,
job_name=job_name,
)
frappe.msgprint(_("Repost has started in the background"))
if len(self.vouchers) > 1:
job_name = "repost_accounting_ledger_" + self.name
frappe.enqueue(
method="erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger.start_repost",
account_repost_doc=self.name,
is_async=True,
job_name=job_name,
)
frappe.msgprint(_("Repost has started in the background"))
else:
start_repost(self.name)


@frappe.whitelist()
Expand Down

0 comments on commit 4123e7b

Please sign in to comment.