fix: do not run bg job for single doc
This commit is contained in:
parent
a856091ff4
commit
1856050ef9
@ -139,6 +139,7 @@ class RepostAccountingLedger(Document):
|
|||||||
return rendered_page
|
return rendered_page
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
if len(self.vouchers) > 1:
|
||||||
job_name = "repost_accounting_ledger_" + self.name
|
job_name = "repost_accounting_ledger_" + self.name
|
||||||
frappe.enqueue(
|
frappe.enqueue(
|
||||||
method="erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger.start_repost",
|
method="erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger.start_repost",
|
||||||
@ -147,6 +148,8 @@ class RepostAccountingLedger(Document):
|
|||||||
job_name=job_name,
|
job_name=job_name,
|
||||||
)
|
)
|
||||||
frappe.msgprint(_("Repost has started in the background"))
|
frappe.msgprint(_("Repost has started in the background"))
|
||||||
|
else:
|
||||||
|
start_repost(self.name)
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user