Change status Task automatic

I am currently working on setting up automation in ERPNext to automatically change the status of tasks to ‘Overdue’ once their expected end date has passed, any advice ?

Hi @thunq,

Here, we share the reference of the code, and how it works.

I hope this helps.

Thank You!

Thank you, I will give it a try.

Hi,

I think it would be useful to have the ability to update the status immediately after updating the expected end date, which would be in the future.

I have created this client script, but I also think it would be a useful feature for the ERPnext community. What is the proper way of adding this kind of feature? Should I create a GitHub issue, create a branch for it, and then send a pull request?

frappe.ui.form.on('Task', {
    exp_end_date(frm) {
        if (frm.doc.status === 'Overdue' && frm.doc.exp_end_date) {
            const today = frappe.datetime.str_to_obj(frappe.datetime.get_today());
            const exp_end = frappe.datetime.str_to_obj(frm.doc.exp_end_date);

            if (exp_end > today) {
                frm.set_value('status', 'Working');
            }
        }
    }
});