fix: default log date needed to query records (#29951)
This commit is contained in:
parent
baee5d109e
commit
700e65959a
@ -3,15 +3,11 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Bulk Transaction Log', {
|
frappe.ui.form.on('Bulk Transaction Log', {
|
||||||
|
|
||||||
before_load: function(frm) {
|
|
||||||
query(frm);
|
|
||||||
},
|
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
frm.add_custom_button(__('Retry Failed Transactions'), ()=>{
|
frm.add_custom_button(__('Retry Failed Transactions'), ()=>{
|
||||||
frappe.confirm(__("Retry Failing Transactions ?"), ()=>{
|
frappe.confirm(__("Retry Failing Transactions ?"), ()=>{
|
||||||
query(frm);
|
query(frm, 1);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -25,8 +21,8 @@ function query(frm) {
|
|||||||
log_date: frm.doc.log_date
|
log_date: frm.doc.log_date
|
||||||
}
|
}
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.message) {
|
if (r.message === "No Failed Records") {
|
||||||
frm.remove_custom_button("Retry Failed Transactions");
|
frappe.show_alert(__(r.message), 5);
|
||||||
} else {
|
} else {
|
||||||
frappe.show_alert(__("Retrying Failed Transactions"), 5);
|
frappe.show_alert(__("Retrying Failed Transactions"), 5);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ class BulkTransactionLog(Document):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def retry_failing_transaction(log_date=None):
|
def retry_failing_transaction(log_date=None):
|
||||||
|
if not log_date:
|
||||||
|
log_date = str(date.today())
|
||||||
btp = frappe.qb.DocType("Bulk Transaction Log Detail")
|
btp = frappe.qb.DocType("Bulk Transaction Log Detail")
|
||||||
data = (
|
data = (
|
||||||
frappe.qb.from_(btp)
|
frappe.qb.from_(btp)
|
||||||
@ -25,9 +27,7 @@ def retry_failing_transaction(log_date=None):
|
|||||||
.where(btp.date == log_date)
|
.where(btp.date == log_date)
|
||||||
).run(as_dict=True)
|
).run(as_dict=True)
|
||||||
|
|
||||||
if data:
|
if data :
|
||||||
if not log_date:
|
|
||||||
log_date = str(date.today())
|
|
||||||
if len(data) > 10:
|
if len(data) > 10:
|
||||||
frappe.enqueue(job, queue="long", job_name="bulk_retry", data=data, log_date=log_date)
|
frappe.enqueue(job, queue="long", job_name="bulk_retry", data=data, log_date=log_date)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user