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

Status

Assignee

Soo Fang Lee

Reporter

Michael Powacht

Labels

None

Tested By

None

Components

Fix versions

Affects versions

Priority

Major
Configure