Bank Clearance causes an error when the clearance_date is before the Payment Entry reference_date.
There should be a protection against this during validation (before save or before submit) of a payment entry. The reference_date should not be permitted AFTER posting_date.
Should this be considered a bug report or a feature request? I consider it a bug because the document creation logic is less restrictive than downstream doctype.
I’m certainly no expert on this, but I think there are circumstances in which a Reference Date should come after a Posting Date. Hardcoding a block against that seems undesirable. (If individual implementations want it, they can always throw a validation error.)
Is there a reason that Clearance Dates should ever come after Reference Dates? What’s the use case? I don’t use the Bank Clearance tool much, though, so I might be misunderstanding the issue.
If someone pays an invoice with a check dated Oct 31 and that check is received on Oct 10th, processing the check via payment entry will be like:
Posting Date = Today (Oct 10)
Reference Date is the date on the check = Oct 31
This payment entry will go through without warning.
If I go to Bank Clearance and try to change or enter a clearance date on another entry, the system won’t allow the change until I fix the clearance date on the above entry to a date on or after the date of the check.
In reality, this issue occurs more by accident. By default, ERPNext automatically fills in the reference_date with today(). If the user does not pay attention, this reference_date can end up being after the posting date, which will cause issues in Bank Clearance. Perhaps the fix for me would be to disallow automatically populating the reference_date in Payment Entry.
Anyway, it just seems like conflicting programming logic to me. If I can save the payment entry, with a date range that will later be rejected by Bank Clearance, why allow it in the first place?
This is where I’m maybe misunderstanding what the Bank Clearance tool does. If the check (correctly) has a clearance date of October 31, why would the clearance date ever be before that?
There are valid reasons for the reference date to be after the posting date, including the example you’re giving. Blocking that seems inappropriate.
It sounds to me like this is the actual crux of the problem. I just looked at my organization’s setup and noticed we override this behavior. If the reference_date isn’t explicitly set, we set it to match the posting_date, not today().