Is it posible to change the date?

Is it possible to change the date that ErpNext uses to know when a payment is due, what date to put on invoices, etc.

I’m playing around on eprnext and I would like to go fordward in time.
I tried changing the server time in which erpnext is running but it didn’t work.

Sure, you can just check the box for “Edit posting date and time” when creating the invoice.

Screenshot 2022-10-03 at 17-16-55 New Purchase Invoice - new-purchase-invoice-1

Thanks for answering.
Sorry, looks like my question wasn’t clear enough. I meant the date and time that erpnext thinks it is at currently.
I just want to simulate that the payroll day is today, that a payment is due, among other things.

That’s not so easy without a flux capacitor… you have to log out of erpnext, change your computer’s time that the browser is on… but then you won’t be able to negotiate SSL/TLS when you try to login again. So you’d have to change the server side as well. Both the ERPNext server and your computer’s browser will have to think it’s the same time in the future.

1 Like

the SSL/TLS part is not a problem, I’m not using https anyways.
I’ve tried changing the server date but it didn’t work. Do I need to change both the serve and client date to make it work even if i’m not using https? or do I need to start looking for that flux capacitor ;)?

Also, maybe it is enough changing the server date but a restart is need. I can’t tell if it works that way because when I restart the server the date goes back to the real one.

Brown’s 1st Law:

:oncoming_automobile: + :zap: + :8ball::8ball: = :hourglass_flowing_sand:

I know this doesn’t help, @slart42. But one of my clients and I have actually been doing this. It required overriding/replacing various code, and being careful. But we’ve got it working pretty well.

Normally, 'frappe.getdate()’ fetches the system’s datetime. We’ve taught it to first look to some Settings. If there are Date or Time values there, use those. Otherwise, behave normally.

This has been most-useful in TEST environments. To simulate how the ERP behaved 2 days ago, or how it will behave 2 weeks from now.

It’s not bulletproof, but has proven useful.


Actually this might be pretty helpful.
I started testing Erpnext about 5 days ago, so I’m not very familiar with the software.
So you go to the source code and modify frappe.getdate() so you can specify the date you want erpnext to be at? and then you compile the source code I guess?
That sound like it could work but I didn’t think this would need this amount of hacking.
Thanks for answering. I will probably try that if I don’t find a simpler way to make it work.

Before you go much further, some words of caution and warning. :warning:

Modifying the Python code directly is certainly possible and arguably practical. However. It is not the recommended approach, or consensus of the community.

Instead, what -most- of us would recommend to you is this:

  1. Read through all the official documentation on the Frappe framework.
  2. If you can achieve something with Customize? Then use Customize.
  3. If you can achieve something by creating a new App? Then write a new App.
  4. If you can achieve something through Hooks, Server Scripts, Client Scripts, and/or guerilla patching? Then do that.

Modifying the code directly (essentially forking your ERPNext) is typically not recommended. Certainly some of us here do it anyway. Because Reasons.

But in good conscience, I cannot suggest you begin doing Possibly Bad Things on your 5th day. Checkout the documentation first, do some searching on the forums, and take some smaller steps, before joining the Dark Side.

1 Like

Changing the server and client date and time worked! thanks

1 Like