Wrong Product Cost Quantity if receipt quantity <> invoiced quantity

Description

Costing method=Average PO

Product=>Costs=>Current Quantity is wrongly updated if the (matched PO) MR quantity does not exactly match with the (matched PO) invoiced quantity.
Below are 2 example scenarios:

SCENARIO 1:

Purchase Order Order Qty=100
Vendor Invoice(1) Qty=100
Partial MR(1) Qty=40
Partial MR(2) Qty=60

3 matched Purchase orders are created:
1.) Invoice Line Qty=100, Receipt Line=null (not posted because no MR assigned)
2.) Receipt Line Qty=40, Invoice Line=null (posted)
3.) Receipt Line Qty=60, Invoice Line=null (posted)

There are 3 issues here:

1.) When performing MR(1) with Qty=40, product cost quantity gets updated to 140 (100+40) instead of 40. When performing MR(2) with qty=60, product cost quantity gets updated to 200 (100+40+60) instead of 100.
2.) The system does not create matched invoices/receipts when recording MR(1) and MR(2)
3.) In the matched PO, the system does not allocate invoice lines to receipt lines. The system should assign a receipt line to the invoice line after each MR (according to matched invoice posting in 2.) which would look like this at the end:
Matched PO 1: Invoice Line1, Receipt Line1 Qty=40
Matched PO 2: Invoice Line1, Receipt Line2 Qty=60

SCENARIO 2:
Purchase Order Qty=100
Vendor Invoice(1) Qty=40
Vendor Invoice(2) Qty=60
Partial MR(1) Qty=40
Partial MR(2) Qty=60

When performing MR(1) with qty=40, product cost quantity gets updated to 100 (40+60) instead of 40.

There are many more combinations causing the above issues.

Environment

None

Activity

Show:
Soo Fang Lee
February 27, 2018, 1:55 PM

Micheal,
The update qty to product cost can be done, however the update the Invoice Line to Matched PO cannot be done. There is a checking qty between Matched PO with the qty of assigned Invoice in the MMatchPO.java. For the qty update product cost resolve in my repository (https://bitbucket.org/soofang/idempiere3) . You may test it.

Michael Powacht
February 28, 2018, 2:46 AM

Thanks Soo Fang, will be testing asap and get back.

Michael Powacht
March 1, 2018, 6:28 AM

Hello Soo Fang, the patch works as expected as far as the costing quantities are concerned.
Please find my test document attached.

Refer to test scenario 1 and 2 in my test document, there is 1 remaining issue for consideration: If the invoice qty > MR qty, it doesn't automatically create a matched invoice/receipt document for the MR quantity, which requires manual matching using Matching PO-Receipt-Invoice.
In contrast, if MR is recorded BEFORE the invoice and invoice qty > MR qty, it does create a matched invoice/receipt document automatically.

Please let me know what you think.

Thanks,
Michael

Heng Sin Low
April 5, 2018, 4:20 AM

https://bitbucket.org/idempiere/idempiere/commits/a51a397

Commited with some adjustment, please verify.

Michael Powacht
April 11, 2018, 8:46 AM

Thanks Hengsin, I successfully re-ran my test scripts.

Assignee

Soo Fang Lee

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

Priority

Major
Configure