I believe I have found the source of an average cost problem.
Purchase 100 pieces of Item A at $29
Item A has an average cost of $30.
User accidentally receives 1000 parts instead of 100
The we correct the receipt. The correction goes back at $30 instead of $29 Putting $900 Into Purchase Price Variance
It should have returned at the $29 price.
Here is the code that dictates this.
-- For non-transit related inventory issues, we only accept the current unit cost as the cost at -- which to relieve inventory. However, even then there are some special cases such as returns of -- previously received units or correcting transactions which could require a variance booking. -- For example purchase order returns should carry a transaction value equal to the original -- purchase price of the units returned which very well could differ from the current unit cost. -- But even in this scenario we still cannot sensibly relieve inventory at a unit cost that -- differs from current unit cost, so our only alternative is to book a variance for the -- difference between transaction value and the inventory value being issued. IF _contextData.warehous_transit AND pOverrideTransValue IS NOT NULL THEN _resolvedUnitCost := pOverrideTransValue / pIssueQty; ELSE _resolvedUnitCost := _contextData.itemsite_unitcost; END IF; _varianceAmount := (_resolvedUnitCost * pIssueQty) - COALESCE(pOverrideTransValue, _resolvedUnitCost * pIssueQty);
Reading a the description it clearly states intent.
Purchase order returns should carry a transaction value equal to the original purchase price of the units returned which very well could differ from the current unit cost
It goes on to state that it will not be following that scenario.
But even in this scenario we still cannot sensibly relieve inventory at a unit cost that differs from current unit cost
What I want to know is why? I could easily change the code to
IF _contextData.warehous_transit **OR** pOverrideTransValue IS NOT NULL THEN
But it seems that xTuple staff has already thought of this and chosen not to do it for a specific reason.