From 07bcc24e35b1f1ca5c9d03c0180e7975c6c266be Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 25 Jan 2024 16:13:24 +0530 Subject: [PATCH 1/2] fix: enqueue JV submission when more than 100 accounts (cherry picked from commit 53b44ccf2907ee15ca4dd6291400272e7cc2acf3) --- .../doctype/journal_entry/journal_entry.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index dd3e9d0bcb7..a2bd5f6b134 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -150,6 +150,20 @@ class JournalEntry(AccountsController): if not self.title: self.title = self.get_title() + def submit(self): + if len(self.accounts) > 100: + msgprint(_("The task has been enqueued as a background job."), alert=True) + self.queue_action("submit", timeout=4600) + else: + self._submit() + + def cancel(self): + if len(self.accounts) > 100: + msgprint(_("The task has been enqueued as a background job."), alert=True) + self.queue_action("cancel", timeout=4600) + else: + self._cancel() + def on_submit(self): self.validate_cheque_info() self.check_credit_limit() From da33079f128b265f5e487a33c0c26d16daa427a1 Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Fri, 26 Jan 2024 20:03:21 +0530 Subject: [PATCH 2/2] fix: return doc obj after submit (cherry picked from commit fc677811b7d896879d9c2537b0527635a8ff3855) --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index a2bd5f6b134..4537dede923 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -155,14 +155,14 @@ class JournalEntry(AccountsController): msgprint(_("The task has been enqueued as a background job."), alert=True) self.queue_action("submit", timeout=4600) else: - self._submit() + return self._submit() def cancel(self): if len(self.accounts) > 100: msgprint(_("The task has been enqueued as a background job."), alert=True) self.queue_action("cancel", timeout=4600) else: - self._cancel() + return self._cancel() def on_submit(self): self.validate_cheque_info()