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.MAcctSchema;
import org.compiere.model.MClientInfo;
import org.compiere.model.MConversionRate;
import org.compiere.model.MCostDetail;
import org.compiere.model.MCurrency;
import org.compiere.model.MInvoice;
@ -851,6 +850,7 @@ public class Doc_Invoice extends Doc
fl.setM_Product_ID(lca.getM_Product_ID());
// Cost Detail - Convert to AcctCurrency
/*
BigDecimal allocationAmt = lca.getAmt();
if (getC_Currency_ID() != as.getC_Currency_ID())
allocationAmt = MConversionRate.convert(getCtx(), allocationAmt,
@ -862,12 +862,13 @@ public class Doc_Invoice extends Doc
if (!dr)
allocationAmt = allocationAmt.negate();
// AZ Goodwill
// use createInvoice to create/update non Material Cost Detail
// use createInvoice to create/update non Material Cost Detail
MCostDetail.createInvoice(as, lca.getAD_Org_ID(),
lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(),
C_InvoiceLine_ID, lca.getM_CostElement_ID(),
allocationAmt, lca.getQty(),
desc, getTrxName());
*/
// end AZ
}

View File

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