Menu

#47 FIFO cannot have starting zero Costs

open
5
2014-08-14
2011-02-18
No

I tested manually (after failing the Fitnesse test) to see if FIFO works. But it hits some constraints, and when i cleared those constraints, it can create some CostDetail but cannot post any costs to Fact_Acct.

Steps to replicate:
1. Create all Cost Types such as AveragePO, FIFO and LIFO but deactivate all else except FIFO for this test
2. Create PO for 1 Hoe and its Material Receipt.
3. Press Complete but hit AmtLL is mandatory as a null was passed into it
(resolve that in http://sourceforge.net/tracker/?func=detail&atid=1349578&aid=3185429&group_id=176962 by replacing null with Env.ZERO)
3.b Hit DivideByZero error in line 151 of LifoFifoCostingMethod.java:
m_CurrentCostPrice = m_CumulatedAmt.divide(m_CumulatedQty, m_as.getCostingPrecision());
Workaround by overstepping this with:
+ m_CurrentCostPrice = Env.ZERO;
+ if (!m_CumulatedQty.equals(Env.ZERO))
m_CurrentCostPrice = m_CumulatedAmt.divide(m_CumulatedQty, m_as.getCostingPrecision());

3.c Hit posting error:
11:51:50.424 Doc_InOut.postLogic: (0) MInOut[1000060-10000516,DocStatus=CO] [11]
11:51:50.425 Doc_InOut.isConvertible: (none) - MInOut[1000060-10000516,DocStatus=CO] [11]
11:51:50.425 MAcctSchema.set_ValueNoCheck: C_Period_ID = 1000001 (java.lang.Integer) [11]
11:51:50.426 MAcctSchema.save: Nothing changed - C_AcctSchema [11]
11:51:50.426 Doc_InOut.setPeriod: 2011-02-18 00:00:00.0 - MMR => 1000001 [11]
11:51:50.426 Doc_InOut.isPeriodOpen: Yes - MInOut[1000060-10000516,DocStatus=CO] [11]
11:51:50.426 Fact.<init>: Fact[MInOut[1000060-10000516,DocStatus=CO],AcctSchema[101-GardenWorld US/A/US Dollar],PostType=A] [11]
11:51:50.426 Query.buildSQL: TableName = M_CostType... SQL = SELECT AD_Client_ID,AD_Org_ID,CostingMethod,Created,CreatedBy,Description,Help,IsActive,M_CostType_ID,Name,Updated,UpdatedBy FROM M_CostType WHERE (AD_Org_ID=?) AND IsActive=? AND AD_Client_ID=? ORDER BY M_CostType_ID [11]
11:51:50.428 Query.createResultSet: Parameter IsActive = Y [11]
11:51:50.428 Query.createResultSet: Parameter AD_Client_ID = 11 [11]
11:51:50.429 MCostType.load: (rs) [11]
11:51:50.429 MCostType.setKeyInfo: (PK) M_CostType_ID=50002 [11]
11:51:50.432 MTable.load: (rs) [11]
11:51:50.433 MTable.setKeyInfo: (PK) AD_Table_ID=808 [11]
11:51:50.433 Query.buildSQL: TableName = M_CostDetail... SQL = SELECT AD_Client_ID,AD_Org_ID,Amt,AmtLL,C_AcctSchema_ID,C_InvoiceLine_ID,C_LandedCostAllocation_ID,C_OrderLine_ID,C_ProjectIssue_ID,CostAdjustment,CostAdjustmentDate,CostAdjustmentDateLL,CostAdjustmentLL,CostAmt,CostAmtLL,CostingMethod,Created,CreatedBy,CumulatedAmt,CumulatedAmtLL,CumulatedQty,CurrentCostPrice,CurrentCostPriceLL,CurrentQty,DateAcct,DeltaAmt,DeltaQty,Description,IsActive,IsReversal,IsSOTrx,M_AttributeSetInstance_ID,M_CostDetail_ID,M_CostElement_ID,M_CostType_ID,M_InOutLine_ID,M_InventoryLine_ID,M_MovementLine_ID,M_Product_ID,M_ProductionLine_ID,M_Transaction_ID,PP_Cost_Collector_ID,(CASE WHEN Qty=0 THEN 0 ELSE Amt/Qty END) AS Price,Processed,Processing,Qty,Updated,UpdatedBy FROM M_CostDetail WHERE (AD_Client_ID=? AND C_AcctSchema_ID=? AND M_Product_ID=? AND M_CostType_ID=? AND M_InOutLine_ID=?) [11]
11:51:50.438 MCostDetail.load: (rs) [11]
11:51:50.439 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000538 [11]
11:51:50.439 MCostDetail.load: (rs) [11]
11:51:50.439 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000539 [11]
11:51:50.439 MCostDetail.load: (rs) [11]
11:51:50.440 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000540 [11]
11:51:50.440 MCostDetail.load: (rs) [11]
11:51:50.440 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000541 [11]
11:51:50.440 MCostDetail.load: (rs) [11]
11:51:50.440 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000542 [11]
11:51:50.441 MCostDetail.load: (rs) [11]
11:51:50.441 MCostDetail.setKeyInfo: (PK) M_CostDetail_ID=1000543 [11]
-----------> Doc_InOut.createFacts: Resubmit - No Costs for Hoe 4 ft [11]
11:51:50.441 Doc_InOut.postCommit: Sta=E DT=MMR ID=1000060 [11]
11:51:50.441 Doc_InOut.save: MInOut[1000060-10000516,DocStatus=CO]->E [11]

SUGGESTED REMEDY:
Study if the business logic of other Costing Methods such as FIFO/LIFO is testable. Has anyone used it? How is it really used? It worked for AveragePO and AverageInvoice.

Discussion

  • Redhuan D. Oon

    Redhuan D. Oon - 2011-02-21
    • assigned_to: teo_sarca --> vpj-cd
    • summary: FIFO testing issues --> FIFO cannot have starting zero Costs
     
  • Redhuan D. Oon

    Redhuan D. Oon - 2011-02-22
    • labels: --> Cost Engine
     
  • Redhuan D. Oon

    Redhuan D. Oon - 2011-02-22

    Here are Fitnesse Tests returning exceptions for MCost and not able to post its accounts for LIFO / FIFO organisations. http://www.adempiere.com/index.php/Cost_Engine/Case_III#Results

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.