Hi, I’m facing a unique problem. I am getting the following error while creating a sales invoice from a delivery note.
Sales Invoice Posting Date Time (08/11/2025 14:53:03) cannot be before Delivery Note Posting Date.
DN # : DCH/S/2526/00680
DN Posting Date & Time: 08/11/2025 09:41:22
However, as the message shows, the delivery note posting is before the Sales Invoice posting date. (In our instance, the users are not allowed to create backdated invoices.) Hence, technically the issue shouldnt come.
I tried going through the source code but I could not find where this error is coming from.
We tried this throughout the same day but same error kept coming. Then the next day, we tried again and in the first attempt, the invoice got created without any issues.
This made me think that while the message shows both date and time, only the date parts are being compared, and the time parts are being ignored.
Am I bonkers in thinking like this? Has anyone else faced this problem? and if so, Is there a solution for this? I’d really appreciate some help here.
I don’t think so. There isn’t any custom check on dates. The check is part of the core validations, and it’s a necessary one. My issue is that the dates in the error message itself contradicts the error. The SI posting date is already later than the DN date.
Since its happening in the live environment, I’m waiting for another such a case to pop up to check the traceback. As soon as I get one, I’ll post the traceback here.
I thing I missed to add earlier that the issue doesnt happen for every Delivery Notes + Sales Invoice combination. It seems to happen sporadically which is also very puzzling.
I think there is.. I noticed that there is an old script that was deployed at the go-live stage. Thanks for pointing me to it. Let me debug it and revert.
It did turn out to be an issue with the custom client script. The issue was that the date comparison in js was not working. We replaced with additional code that did explicit conversion of dates before comparing them. That solved the problem.