Frappe.delete_doc() didn't work

Hi all,
here i have a piece of code

print('----deleting all run time----')
try:
	run_time = frappe.db.get_list('run time')
	for r in run_time:
		print('name: ',r['name'])
		frappe.delete_doc('run time',r['name'])
except Exception as e:
	print('error deleting run time: ',e)

but when this code ran, the documents weren’t deleted
there is no error as you can see below

And this below is the ‘run time.py’ file

Screenshot from 2023-09-15 10-53-29

Anyone have any idea why this happens?
Thanks in advance

frappe.delete_doc(‘run time’, r[‘name’], ignore_missing=True)

Try this

1 Like

Hi @ganureddy , thank you for the suggestion, i have tried it but unfortunately, it doesn’t work

Try frappe.db.commit() after the for loop.
If this works for you then check if you are making a POST request or GET request, because in case of GET request database changes are not committed.

2 Likes

@Sandeep_Kakde That’s work! Thank you so much. You really save me here.