From 97663971b5032f0c969674e56bcd9cf2e0934034 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 31 Aug 2013 01:03:21 +0800 Subject: [PATCH] IDEMPIERE-1316 Do not perform average, lifo and fifo costing recalculation for Non Stock Item. --- .../src/org/compiere/model/MCostDetail.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCostDetail.java b/org.adempiere.base/src/org/compiere/model/MCostDetail.java index 673d58b1e7..1d80ca77a7 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostDetail.java +++ b/org.adempiere.base/src/org/compiere/model/MCostDetail.java @@ -853,6 +853,11 @@ public class MCostDetail extends X_M_CostDetail for (int i = 0; i < ces.length; i++) { MCostElement ce = ces[i]; + if (ce.isAverageInvoice() || ce.isAveragePO() || ce.isLifo() || ce.isFifo()) + { + if (!product.isStocked()) + continue; + } ok = process (as, product, ce, Org_ID, M_ASI_ID); if (!ok) break; @@ -866,6 +871,11 @@ public class MCostDetail extends X_M_CostDetail MCostElement[] ces = MCostElement.getCostingMethods(this); for (MCostElement costingElement : ces) { + if (costingElement.isAverageInvoice() || costingElement.isAveragePO() || costingElement.isLifo() || costingElement.isFifo()) + { + if (!product.isStocked()) + continue; + } ok = process (as, product, costingElement, Org_ID, M_ASI_ID); if (!ok) break; @@ -873,7 +883,15 @@ public class MCostDetail extends X_M_CostDetail } else { - ok = process (as, product, ce, Org_ID, M_ASI_ID); + if (ce.isAverageInvoice() || ce.isAveragePO() || ce.isLifo() || ce.isFifo()) + { + if (product.isStocked()) + ok = process (as, product, ce, Org_ID, M_ASI_ID); + } + else + { + ok = process (as, product, ce, Org_ID, M_ASI_ID); + } } }