Cost Engine/Case III

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
Note.gif Note:

This Use Case is based on Libero's Cost Engine/Testing for different Costing Methods, maintained by Redhuan D. Oon.

Testing Goals

  1. Test Transactions of Multiple Organisations using different Cost Types.
  2. Test HQ's Average Invoice Costing and Store's Standard Costing results on similar transaction.
  3. Test other organisations using FiFO and LiFO.
  4. Test similar Average Costing of same product but in different Organisation/Warehouse.

User Setup Data

  • Client:GardenWorld
  • Organisation: Default, AverageInv, AveragePO, FIFO, LIFO (setup in migration script for Orgs and Warehouses).
  • Calendar:Default
  • Currency:USD
  • Product: New (created from migration script for Apple and Freight Charge)
  • Charge: Freight and Customs Tax (created from migration script for Customs).
  • Vendor: Standard
  • CostType: Average Costing and Standard Costing
  • Starting Date: Jan 1, 2010

Transaction Input

  • Days from Today: Added to Starting Date
  • Org: Organisation that is set to respective Costing Method in Cost Type window
  • Qty: Quantity in transaction
  • Price: Purchase or Sales Price
  • Transaction Type:
    • Purchase/Receipt - Purchase Order and Material Receipt of the same order
    • Credit Sales - Sales Order which results in immediate Shipment
    • Invoice Receipt - Invoice Vendor of a previous Material Receipt
    • View Shipment - Access of a previous Sales Shipment record
    • Reverse Receipt - Reverse-Correct of a previous Material Receipt
    • Movement - creation of an Inventory Movement
    • Physical Inventory - creation of a Physical Inventory with Book Qty taken from the last Cost Detail's Accumulated Qty
    • Internal Use - taking from inventory for internal use, minus qty is the qty taken
  • Ref: Reference count of previous transactions passed to present transaction
  • Initiate Transaction - Assert of Transaction success.

Output Format

From MCost table

  • Current Cost Price
  • Cumulative Qty
  • Cumulative Amt

From CostDetail table

  • Cost Detail Amt
  • CD Adjust
  • CD Qty
  • CD Current Cost
  • CD Cumulative Qty
  • CD Cumulative Amt

Testing Steps

  1. Assign different organisations assigned to different Cost Types in GardenWorld. (Manually done with migration script)
  2. Deactivate Cost Type of Organisation = * //testing without such change
  3. Assign Cost Type of Standard Cost to Store Central.
  4. Execute Test from Case I where Document's Organisation is set to AveragePO.
  5. Repeat the last for "FIFO" and "LIFO".



  • This result output follows a test case suggested by Sysnova which is to handle a mistaken PO that has wrong cost. Later a reversal is done on its receipt and a new PO is reissued. Will the costing be corrected?
Outcome of Average PO reversal test. Organisation can be set to Average Invoice to return other results
Transaction Valuation Report showing the wrongful purchase corrected
Effective Date Inventory Report showing the right final value


  • FIFO testing hits MCost fields getting nulls (see issue tracker at the bottom). What this test does is just replacing the Organisation with one that has its own Cost Type where CostMethod is FIFO.
FIFO hitting exceptions due to null field value in MCost


  • LIFO has the same results as FIFO.
FIFO hitting exceptions due to null field value in MCost