IDEMPIERE-362 Hide things that don't work on iDempiere. Disable broken auto landed cost calculation for average costing.

This commit is contained in:
Heng Sin Low 2013-03-19 21:24:27 +08:00
parent 7fe2047a1a
commit b1e0cdcef6
2 changed files with 13 additions and 8 deletions

View File

@ -26,7 +26,6 @@ import java.util.logging.Level;
import org.compiere.model.MAccount; import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema; import org.compiere.model.MAcctSchema;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MConversionRate;
import org.compiere.model.MCostDetail; import org.compiere.model.MCostDetail;
import org.compiere.model.MCurrency; import org.compiere.model.MCurrency;
import org.compiere.model.MInvoice; import org.compiere.model.MInvoice;
@ -851,6 +850,7 @@ public class Doc_Invoice extends Doc
fl.setM_Product_ID(lca.getM_Product_ID()); fl.setM_Product_ID(lca.getM_Product_ID());
// Cost Detail - Convert to AcctCurrency // Cost Detail - Convert to AcctCurrency
/*
BigDecimal allocationAmt = lca.getAmt(); BigDecimal allocationAmt = lca.getAmt();
if (getC_Currency_ID() != as.getC_Currency_ID()) if (getC_Currency_ID() != as.getC_Currency_ID())
allocationAmt = MConversionRate.convert(getCtx(), allocationAmt, allocationAmt = MConversionRate.convert(getCtx(), allocationAmt,
@ -868,6 +868,7 @@ public class Doc_Invoice extends Doc
C_InvoiceLine_ID, lca.getM_CostElement_ID(), C_InvoiceLine_ID, lca.getM_CostElement_ID(),
allocationAmt, lca.getQty(), allocationAmt, lca.getQty(),
desc, getTrxName()); desc, getTrxName());
*/
// end AZ // end AZ
} }

View File

@ -988,6 +988,7 @@ public class MCostDetail extends X_M_CostDetail
cost.add(amt, qty); cost.add(amt, qty);
if (log.isLoggable(Level.FINER)) log.finer("Inv - UserDef - " + cost); if (log.isLoggable(Level.FINER)) log.finer("Inv - UserDef - " + cost);
} }
/*
else if (!ce.isCostingMethod()) // Cost Adjustments else if (!ce.isCostingMethod()) // Cost Adjustments
{ {
// AZ Goodwill // AZ Goodwill
@ -996,12 +997,12 @@ public class MCostDetail extends X_M_CostDetail
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) || if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod)) MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod))
{ {
/** Problem with Landed Costs: certain cost element may not occur in every purchases, // Problem with Landed Costs: certain cost element may not occur in every purchases,
* causing the average calculation of that cost element wrongly took the current qty. // causing the average calculation of that cost element wrongly took the current qty.
* //
* Solution: // Solution:
* Make sure the current qty is reflecting the actual qty in storage // Make sure the current qty is reflecting the actual qty in storage
*/ //
StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand") StringBuilder sql = new StringBuilder("SELECT COALESCE(SUM(QtyOnHand),0) FROM M_StorageOnHand")
.append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID()) .append(" WHERE AD_Client_ID=").append(cost.getAD_Client_ID())
.append(" AND M_Product_ID=").append(cost.getM_Product_ID()); .append(" AND M_Product_ID=").append(cost.getM_Product_ID());
@ -1033,6 +1034,7 @@ public class MCostDetail extends X_M_CostDetail
// end AZ // end AZ
if (log.isLoggable(Level.FINER)) log.finer("Inv - Landed Costs - " + cost); if (log.isLoggable(Level.FINER)) log.finer("Inv - Landed Costs - " + cost);
} }
*/
// else // else
// log.warning("Inv - " + ce + " - " + cost); // log.warning("Inv - " + ce + " - " + cost);
} }
@ -1152,6 +1154,7 @@ public class MCostDetail extends X_M_CostDetail
//AZ Goodwill //AZ Goodwill
//Also update Landed Costs to reflect the actual qty in storage //Also update Landed Costs to reflect the actual qty in storage
/*
String costingMethod = ce.getCostingMethod(); String costingMethod = ce.getCostingMethod();
if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) || if (MAcctSchema.COSTINGMETHOD_AveragePO.equals(costingMethod) ||
MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod)) MAcctSchema.COSTINGMETHOD_AverageInvoice.equals(costingMethod))
@ -1194,6 +1197,7 @@ public class MCostDetail extends X_M_CostDetail
} }
}//end-if }//end-if
} }
*/
//end AZ //end AZ
} }
else // unknown or no id else // unknown or no id