Multiple receipts on one purchase order line causes faulty Average PO calculation due to error in cost detail

Description

Steps how to reproduce the error:
1. Create a product with purchase price 100.
2. Create and complete a purchase order for 10 units of the product.
3. Create and complete a material receipt for that order with 5 units. Use "create from order".
4. Create and complete one more material receipt for that order with 5 units. Use "Create from order".
5. Create and complete a purchase order for 5 units of the product. Change purchase price to 150.
6. Create and complete a material reciept for that order with 5 units. Use "create from order"
7. Create and complete a vendor invoice for all 15 units. Use create from order.
8. Run Client Accounting Processor
9. Match PO-Receipt-Invoice Invoice -> Receipt.
10. Run client accounting processor

NOTE!! This error seems to turn out different depending on when the accounting processor is run. If the accounting processor is run between each step the result is different than if it's run only in the end.

Errors:
1. Because of step 4 a faulty Cost Detail Record is created when accounting processor is run last. Qty is set to 10 instead of 5.
2. Step 7 doesn't automatically match the invoice line to the first receipt line created in step 4. Only the last receipt is matched. Manual matching is required. See IDEMPIERE-514.
3. Error 1 causes Average PO to be wrongly calculated.
4. Standard costing doesn't look right either.

Alternatives:

  • If accounting processor is run between each step, Average Invoice turns out wrong and average PO will be correct. Match PO-Receipt-Invoice Purchase Order -> Receipt will show unmatched PO-line even though it's matched.

  • If accounting processor is run between steps 6 and 7 everything turns out correct.

A clue to the problem might be that when the accounting processor is run between each step a purchase order cost detail record is created for each receipt but when the accounting processor is run last one receipt is counted twice.

Environment

Swing, rev 7944

Attachments

2
100% Done
Loading...

Activity

Show:

Martin Schönbeck May 9, 2020 at 3:42 PM
Edited

triaged by in 7.1z

no longer reproducable. May be due the now immediate posting but probably because the matching of material receipt to invoice is now done automatically in a correct way the Average PO calculation is correct now.

Because the condition for reproducing (unmatched material receipt) is definitely gone ticket set to resolved.

Daniel Tamm June 28, 2013 at 1:57 PM

Nice work Getting closer is very good!

I don't know how the exact structure is now, but I agree with Armen's conclusions. Separating the match invoice and match receipt more would be a cleaner approach than in ADempiere.

/Daniel

Heng Sin Low June 27, 2013 at 8:57 PM

Result from testing with release 1.0c:

1) The cost detail created for match po line is correct but there's one wrong cost detail record created for invoice line.

2) The current cost for average po is calculated correctly

3) Matching of invoice and receipt line happens without manual matching.

Still not 100% but it is getting closer now.

Regards,
Low

Armen Rizal June 11, 2013 at 11:44 AM

Hi Daniel,

I think the root of the problem is in MatchPO structure. Currently it holds links both PO to Receipt and PO to Invoice which prone to error when the received qty and invoiced qty are different.

My take on this is to separate MatchPO of PO to Receipt from PO to Invoice. Only MatchPO of PO to Receipt is used to generate Cost Detail, meanwhile MatchPO of PO to Invoice is used to update OrderLine's QtyInvoiced only.

Best regards,

Armen Rizal

Fixed

Details

Assignee

Reporter

Labels

Tested By

Martin Schönbeck

Original estimate

Time tracking

No time logged4h 8m remaining

Components

Priority

Created November 22, 2012 at 4:52 PM
Updated July 1, 2020 at 7:52 PM
Resolved May 9, 2020 at 3:42 PM