commit | a393a6b76c35d95e4422fbf239c468ab48e67b71 | [log] [tgz] |
---|---|---|
author | ruthra kumar <ruthra@erpnext.com> | Mon Nov 13 10:39:40 2023 +0530 |
committer | ruthra kumar <ruthra@erpnext.com> | Mon Nov 13 10:39:40 2023 +0530 |
tree | ca0d7a65be2d1e348f3b6468e487d459a5f0dbf1 | |
parent | a52a1b49af1c7b72ba85563057f60bb7cf54e81c [diff] |
refactor: raise exception on invalid date
diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.js b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.js index 3135d41..dc54d60 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.js +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.js
@@ -14,7 +14,7 @@ frappe.call({ method: "erpnext.utilities.bulk_transaction.retry", args: {date: frm.doc.date} - }).then(()=> { }); + }); }); } },
diff --git a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py index 8ae54dd..712caf1 100644 --- a/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py +++ b/erpnext/bulk_transaction/doctype/bulk_transaction_log/bulk_transaction_log.py
@@ -15,6 +15,13 @@ def load_from_db(self): log_detail = qb.DocType("Bulk Transaction Log Detail") + + has_records = frappe.db.sql( + f"select exists (select * from `tabBulk Transaction Log Detail` where date = '{self.name}');" + )[0][0] + if not has_records: + raise frappe.DoesNotExistError + succeeded_logs = ( qb.from_(log_detail) .select(Count(log_detail.date).as_("count"))