Status Overdue Custom Script


as we know that the Project - Tasks
Task has a status like open - close so on
and one of its status to be Overdue

Offcourse the system is making the task in Overdue state
Expected End Date has come without any action

I mad a new Doctype nmae Feed

with Tow Custome fields

enddate ---- Type Date
status — Type Select ( open - close - working on - overdue )

Lets Take an example

If enddate = 17-3-2018
and Today is > 17-3-2018
So the script change the status filed automatically to be overdue
same manner of project - task mechanism .

Best regards .

Any Guide Dears

I can give you a code but it’ll need you to actually open the doc for it to be updated, it wont be updated automatically

1 Like

can u please explain in details
what is the meaning of open the doc ?
thank u

any suggestions dears

Below method will update the status as you’r willing for but only when someone changes end_date field, not automatically. you can call this function on any change you feels better.
Hopes someone will tell you a method for changing the status automatically like tasks,

Make “Status” field with datatype “Select” option “Open , Close , Working , Overdue” in “Feed”

and use this script.


end_date: function(frm){


var change_status = function(frm)
var today = frappe.datetime.get_today();

if(frm.doc.end_date < today)
		frm.set_value("status", "Overdue");


1 Like

Many thx dear. I will try the manual way. And feed u back.
And as u said dear we hope to find an automatic way.


I know an automatic way, but it only works if you have acces to the server. Are you using the hosted version?

1 Like

Dear :

i am using virtual image that i downloaded from the erpnextsite

Best Regards

Ok then it works like this:
1.Create in your doctype folder a file called
2.Add in file a function like this:

def set_feed_as_overdue():
	frappe.db.sql("""update tabFeed set `status`='Overdue'
		where exp_end_date is not null
		and exp_end_date < CURDATE()
		and `status` not in ('Closed', 'Cancelled')""")

3.Add following in of ERPNext in "scheduler_events = {…“daily”: […
"erpnext.[your module].doctype.feed.feed.set_feed_as_overdue"

Now it will check every day if one or more of youre feeds is overdue and if so it will set status overdue to it/them.

Hope this helps!



Dear: joelios

many many thanks I will try it and feed you back.

Can we use this method with a little of modification in another scenario

For example

Healthcare module , there is a patient appointment doctype
lets say
patient A booked a ppointment after month from now
can we send him an email to remind him with one week befor his appointment

with same methodology
we will let mysql check the date every day and if it founds the ( todaydate +7)=appointment date
so it will send an email to the client to remind him that his appointment will be during week .

Hi @sheno

This is even easier without any customizations!
There is a standard feature in ERPNext called “Email Alert”.
You can perfectly cover this use case with it. :wink:

1 Like

actually i used the email alret but it didnt success
it success only with me

Dont use “Custom”, use instead “Days Before”! :wink:

1 Like

i will test it and feed u back dear many many thx

1 Like

Can we possible run schedular manually if yes so please guide me.

 bench execute frappe.utils.scheduler.enqueue_scheduler_events