Negative Qty on Match_Inv is accounted wrong

Description

In some cases it is possible (and desirable) to adjust matched invoices with a negative quantity.
This can be done by using the VMatch form, when for instance selecting many rows where some are "overmatched" and some are "undermatched" but it all equals out.

The root of the problem is that it's possible to "overmatch" meaning that one receipt is matched to more invoice lines than the total quantity of the receipt.

If an overmatch has happened a corresponding negative match can be made using the VMatch form and a MatchInv with a negative quantity is created.

When this MatchInv is accounted, the accounting is NOT reversed due to .abs() calls on lines 158 and 192 in file Doc_MatchInv.

The commitment release also gets wrong with wrong multiplications and sign. This bug creates serious accounting differences for the NotInvoiceReceipt and InventoryClearing accounts.

But, as said, the root of the problem is that it's possible to "overmatch", and there's probably a lot of ADempiere systems out there with overmatched MatchInv.

Environment

None

Activity

Show:
Daniel Tamm
May 15, 2012, 5:10 PM

This seems to be a bigger problem than I first anticipated.
The reason why .abs() is present is because I suspect that's supposed to work with matching of Vendor Credit Notes and Vendor Returns.
However, in the Matching Form, Vendor Returns and Vendor Credit Notes are presented as positive numbers and can as such be matched to Vendor Receipts and Vendor Invoices... which is wrong.

I'm working on a solution for this and I will post as I resolve.

Carlos Ruiz
May 25, 2012, 7:42 AM

Hi Daniel, it sounds like the .abs() must take into account the docbasetype?

Heng Sin Low
April 26, 2013, 10:00 AM

We have added validation in iDempiere to prevent over matching. Please reopen this issue if it still happen in your testing.

Assignee

Heng Sin Low

Reporter

Daniel Tamm

Labels

Tested By

None

Time tracking

8h

Components

Fix versions

Affects versions

Priority

Minor
Configure