Make Sales Order button is not showing

The console test is based on this line code:

I did some tests and got this:

But if I run this script on browser console the Make Sales Order button appears:

if(!cur_frm.doc.valid_till || frappe.datetime.get_diff(cur_frm.doc.valid_till, frappe.datetime.get_today()) >= 0) {
				cur_frm.add_custom_button(__('Sales Order'),
					cur_frm.cscript['Make Sales Order'], __('Create'));

So, today stills 31th, why the button is not showing automaticaly?