Skip to content

Commit

Permalink
refactor: raise exception on invalid date
Browse files Browse the repository at this point in the history
(cherry picked from commit a393a6b)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Nov 17, 2023
1 parent 8dbe753 commit fa1f623
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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(()=> { });
});
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def db_insert(self, *args, **kwargs):

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"))
Expand Down

0 comments on commit fa1f623

Please sign in to comment.