I’m trying to auto create task, but my server script have some problem can anyone help me
Hi @thunq:
Just write your logic, no method definition needed.
task = frappe.get_doc({
"doctype": "Task",
"subject": "New task",
"status": "Open"
})
task.insert()
Hope this helps.
it still have that error
i think i know the problem is wrong when i use “exp_end_date”: frappe.utils.now_datetime().date() + frappe.utils.timedelta(days=1). is there a way i can get the exp_end_date to be one day after the start date.
Hi @thunq:
It’s working for me …
Try this:
today = frappe.utils.today()
tomorrow = frappe.utils.add_days(today,1)
task = frappe.get_doc({
"doctype": "Task",
"subject": "New task",
"status": "Open",
"exp_start_date": today,
"exp_end_date": tomorrow
})
task.insert()
Hope this helps.
thank you, i will give it a try