refactor: raise exception on invalid date

(cherry picked from commit a393a6b76c35d95e4422fbf239c468ab48e67b71)
This commit is contained in:
ruthra kumar 2023-11-13 10:39:40 +05:30 committed by Mergify
parent f28d718732
commit 0134be4915
2 changed files with 8 additions and 1 deletions

View File

@ -14,7 +14,7 @@ frappe.ui.form.on("Bulk Transaction Log", {
frappe.call({
method: "erpnext.utilities.bulk_transaction.retry",
args: {date: frm.doc.date}
}).then(()=> { });
});
});
}
},

View File

@ -15,6 +15,13 @@ class BulkTransactionLog(Document):
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"))