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); + } } }