Product Cost Issue - Average PO & Batch/Lot

147 views
Skip to first unread message

Muhammad Rizwan Anwar

unread,
Sep 4, 2021, 11:00:42 AM9/4/21
to iDempiere
Dear All,

We have the following configuration for Product Costing in an iDempiere Installation:

1. Costing Method: Average PO
2. Costing Level: Batch/Lot
3. Attribute Set is attached with "IsAutoGenerateLot" functionality to produce Lot Numbers automatically

The system generates Costs accurately at the time of Material Receipts and Production Order (Single Production). This is very stable and there is no issue.
But sometimes the system increases the Cost of Some Product Lots (In the M_Cost table) very high at the time of consumption entries like Customer Shipments/Internal User Inventory/Production Lines etc.
We are not able to figure out the exact reason for this abnormal behavior. Please guide us on how we can find out the reason.

Thank you

Rizwan Anwar

Heng Sin Low

unread,
Sep 4, 2021, 11:07:56 AM9/4/21
to idem...@googlegroups.com
Usually consumption shouldn't be an issue it should not change your average cost at all. One exception here is when your on hand (in your case, the on hand for your lot) goes to -ve and perhaps that's one area you should check it. The other things that could goes wrong are the flow that's outside of the normal trx flow, for e.g reversal of transaction and RMA return.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/7f5e3f11-f837-468f-b610-0b747eb97431n%40googlegroups.com.

Muhammad Rizwan Anwar

unread,
Sep 4, 2021, 12:37:16 PM9/4/21
to iDempiere
Thank you very much for the quick response.

We have disabled Negative Inventory so the system doesn't allow -ve quantities.

Reversals are frequently made in the system. What can be the workaround if Reversals/RMAs are the reason for the change of Average Cost?

Currently, to correct the accounting, we manually change the Average Cost of the Product Lot and repost all the relevant transactions.

Heng Sin Low

unread,
Sep 4, 2021, 11:30:42 PM9/4/21
to idem...@googlegroups.com
Well, first, you have to test and confirm that indeed is the issue here. 

Then we can talk about whether there's a workaround or it is a blocking issue that needs to be resolved.

Muhammad Rizwan Anwar

unread,
Sep 5, 2021, 11:39:36 PM9/5/21
to iDempiere
Okay. I Will test comprehensively and share the results here soon. Thanks

KiênDX - Việt Nam

unread,
Sep 7, 2021, 6:17:16 AM9/7/21
to iDempiere
This problem I have encountered. I have to edit the code in MCost.java and MCostDetail.java.
In file MCost.java: 
method setWeightedAverage (BigDecimal amt, BigDecimal qty) , you add param MovementType.

I not calculate cost when MovementType in ('V-','C+')

if (Util.isEmpty(MovementType) 
|| (!Util.isEmpty(MovementType) 
&& (!MovementType.equals("V-") && !MovementType.equals("C+")))) {
BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty());
BigDecimal newSum = amt;
BigDecimal sumAmt = oldSum.add(newSum);
BigDecimal sumQty = getCurrentQty().add(qty);
if (sumQty.signum() != 0)
{
BigDecimal cost = sumAmt.divide(sumQty, 12, RoundingMode.HALF_UP);
setCurrentCostPrice(cost);
}
}

you can refer to this solution


Vào lúc 10:39:36 UTC+7 ngày Thứ Hai, 6 tháng 9, 2021, see2r...@gmail.com đã viết:

Heng Sin Low

unread,
Sep 7, 2021, 7:25:34 AM9/7/21
to idem...@googlegroups.com
Hi,

It will be greatly appreciated if you can post the issue and solutions to a Jira ticket.

Thanks & Regards,
Low

Muhammad Rizwan Anwar

unread,
Sep 7, 2021, 9:23:53 AM9/7/21
to iDempiere
Here is the Jira Ticket


I will share my testing there
Reply all
Reply to author
Forward
0 new messages