From b1e0cdcef6cda2384f1a49c462b1630eb9e28c85 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 19 Mar 2013 21:24:27 +0800 Subject: [PATCH] IDEMPIERE-362 Hide things that don't work on iDempiere. Disable broken auto landed cost calculation for average costing. --- .../src/org/compiere/acct/Doc_Invoice.java | 5 +++-- .../src/org/compiere/model/MCostDetail.java | 16 ++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java index 8021c57e02..fdb042e4a2 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Invoice.java @@ -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 } diff --git a/org.adempiere.base/src/org/compiere/model/MCostDetail.java b/org.adempiere.base/src/org/compiere/model/MCostDetail.java index 719af4c2a5..faa9bbeef8 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostDetail.java +++ b/org.adempiere.base/src/org/compiere/model/MCostDetail.java @@ -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