fix: do not run bg job for single doc

(cherry picked from commit 1856050ef9)
This commit is contained in:
Gursheen Anand
2023-09-23 19:30:42 +05:30
committed by ruthra kumar
parent c9bcf79e83
commit 4123e7b244

View File

@@ -139,14 +139,17 @@ class RepostAccountingLedger(Document):
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()