Date auto fetch problem

Hi, We have a problem about our date auto fetch (today). When we make a file it works great and can be edited for that certain day but if the day passed by you can’t edit/update the file because of the date auto fetch that gives an error message.

Not allowed to change Date Requested after submission
Did not save

Is there a script that can fetch date and then will not try to change the date if the day passed by?

Hope you can help us with this concern.

@kelscey90 which transaction?

@rmehta, hi sorry for asking but what do you mean by which transaction? Is it module you’re saying? Coz the module that is having is the newly made module.

Can you specify how you’re doing a “date auto fetch”?

@vjFaLk, When I was trying it, it was like this

frm.set_value(“date_requested”, frappe.datetime.add_days(frappe.datetime.nowdate()));]

But now I’ve changed it to

frm.set_value(“date_requested”, frappe.datetime.get_today());

I haven’t tried the change though.

If you want today’s date to be set to a field whenever you create a new Document, just add Today to the Default section of that field in your DocType.

@vjFaLk, ohhhhh wow! That’s easier! :smiley: Thank you!

1 Like