Wrong allocation date stops accounting

Description

When trying to fix bug a very annoying sideeffect occured.
The side effect is that pre payments can't be allocated to invoices without trouble.

MAllocationHdr:442-454.java

Correct code

Environment

None

Activity

Show:
Daniel Tamm
February 12, 2016, 3:32 PM
Carlos Ruiz
February 17, 2016, 1:47 PM

Daniel, I just tried different steps to make it fail on the Allocation window.

The only way to force it to fail was setting a date manually on the allocation window, before the documents, the error is clear "Wrong allocation date", and the fix was very simple, just to set the date back to a correct date.

Am I missing something?

Regards,

Carlos Ruiz

Daniel Tamm
February 17, 2016, 2:12 PM

The allocation window isn't the problem. We have the following problem scenario:

  • The invoice is generated after shipment at a later date than the payment

  • When the bank statement is reconciled via bank statement and the "Create payment from invoice" is used the allocation fails (actually the whole process create payment from invoice fails).

We also have other scenarios when we programmatically match invoices to existing pre-payments and this code stopped working after the fix. We can of course tweak our code but I think my code change suggestion is reasonable. An error message that says "Wrong allocation date" isn't useful for the end user, especially when my code suggestion makes the dates correct without having to alert the user.

Thanks for looking at this

Carlos Ruiz
February 17, 2016, 2:31 PM

Thanks ,

I'm usually not comfortable about changing data that user entered, in this case the user enter a date, but the patch changes the DateAcct in the back of the user.

I would prefer something in sync with what you said to fix the "create payment from invoice" - which is that class and how can we set the proper dateacct there?

Daniel Tamm
February 18, 2016, 12:12 PM

Found a perfect example when the error occurs (see above).

I understand your concern. However, in this case the user hasn't entered a date. When it comes to allocation it's the system that sets the date. The reason why was a bug from an accounting perspective was that it didn't always choose the latest date of the payment or invoice for the allocation.

The accounting rule says:

"When accounting an allocation (match payment to invoice), use the latest date of the two documents for the allocation/match. "

There's no reason that the user should be able to change this behaviour.

If you look closely, no user entered data is changed, what my code does is pick the right accounting date for the allocation that is created (using one of the dates the user entered for the documents that are allocated).The user doesn't actually create the allocation document, it's created in the background.

It would be very nice if my patch was applied

Assignee

Daniel Tamm

Reporter

Daniel Tamm

Labels

Tested By

None

Components

Affects versions

Due date

2016/02/19

Priority

Major
Configure