Paul Foxworthy created OFBIZ-9500:
-------------------------------------
Summary: Maintain accountingQuantity for all COGS valuation methods
Key: OFBIZ-9500
URL: https://issues.apache.org/jira/browse/OFBIZ-9500
Project: OFBiz
Issue Type: Improvement
Components: accounting, order, product
Affects Versions: Trunk
Reporter: Paul Foxworthy
>From
>http://ofbiz.135035.n4.nabble.com/AccountingQuantity-COGS-method-and-inventory-valuation-td4700867.html
*1. Why accounting quantity?
When inventory is shipped, there's an accounting transaction that debits the
inventory on hand value and credits Cost of Goods Sold (COGS).
There's more than one way of deciding what value is added to COGS.
First and most obvious is the actual cost of the inventory item. But companies
may prefer other strategies. OFBiz has the option of three others: average
cost, first-in-first-out or last-in-first-out. There's a nice survey of *why*
you might choose one of these at
http://www.dummies.com/business/operations-management/choosing-an-
accounting-method-for-the-cost-of-goods-sold-expense/,
http://www.dummies.com/business/accounting/the-fifo-
method-for-cost-of-goods-sold/, http://www.dummies.com/
business/accounting/the-lifo-method-for-cost-of-goods-sold/
Note that if you choose anything other than inventory item cost, the money
amount transferred to the COGS account may be *different* to the cost price of
the inventory items being shipped. When you choose FIFO or LIFO, the amount may
have originated from a different inventory item, received at a different time.
*2. Current situation in OFBiz
The cogsMethodId field in the PartyAcctgPreference entity is a enum with four
possible values: COGS_INV_COST, COGS_AVG_COST, COGS_FIFO, COGS_LIFO..
The accountingQuantity field in the InventoryItem entity and
accountingQuantityDiff in the InventoryItemDetail entity track the quantity of
an item still "live" for the purpose of inventory valuation and COGS.
In the service createAcctgTransForShipmentReceipt implemented in
/applications/accounting/minilang/ledger/GeneralLedgerServices.xml
(http://svn.apache.org/viewvc/ofbiz/trunk/applications/
accounting/minilang/ledger/GeneralLedgerServices.xml?view=markup#l1306)
the accountingQuantity is always set to the same value as the quantity received
(i.e. the same as the quantityOnHand) for a newly received inventory item
regardless of the COGS method.
When items are shipped, the service createAcctgTransForSalesShipmentIssuance
will only reduce the accounting quantity if the COGS method is FIFO or LIFO
(http://svn.apache.org/viewvc/
ofbiz/trunk/applications/accounting/minilang/ledger/
GeneralLedgerServices.xml?view=markup#l1127).
With FIFO, when an item is shipped, inventory items for the product with a
non-zero accounting quantity are found sorted from earliest to latest received.
The quantity of the item shipped must be decremented from the accounting
quantities, starting with the earliest. Similarly, with LIFO, items are sorted
from latest to earliest, and the latest item or items are
decremented.
In other words, if you have chosen a COGS method of COGS_INV_COST or
COGS_AVG_COST, the accounting quantity is meaningless and in OFBiz as of
now, should be ignored.
And yet, the Inventory Valuation report uses accounting quantity, regardless of
the the COGS method (http://svn.apache.org/viewvc/
ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.
xml?view=markup#l535). In other words, the Inventory Valuation report is broken
for COGS methods of COGS_INV_COST or COGS_AVG_COST.
*3. What should happen
The Inventory Valuation report, and anybody else who cares, should always be
able to trust the accounting quantity. For COGS_INV_COST and COGS_AVG_COST,
maintaining the accounting quantity is simple -
createAcctgTransForSalesShipmentIssuanceit should just adjust it to match the
remaining quantity on hand.
No matter what the COGS method, the total accounting quantity for a product
across all inventory items should always be equal to the total QOH.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)