Timesheet multi selection delete

i want to delet all the timesheet and start from begining

  • the timesheet to be deleted it must be first cancel then i can delet it

But i have many time time sheet so i have to manulay open every time sheet and cancel then be able to delet

is there another way to multi cancel multi delet ?

thank alot for your help .

Hi @sheno,

If the timesheet is not linked with any doctype then it can be feasible

Run below script from the bench console

for data in frappe.get_list('Timesheet', fields = ["name"], filters = ["docstatus", "<", "2"]):
	doc = frappe.get_doc('Timesheet', data.name)
	if doc.docstatus == 1:
		doc.cancel()
	frappe.delete_doc('Timesheet', data.name)
2 Likes

Thx a lot dear for your help