View source | View content page | Page history | Printable version   



FIFO Costing Algorithm

This module provides a new Costing Algorithm to be used in the new Costing Engine.

This module was sponsored by Agility ERP.


FIFO, which stands for "first-in-first-out," is an inventory costing method which assumes that the first items placed in inventory are the first sold. Therefore materials are issued from the oldest supply in stock and that the cost of those units when placed in stock is the cost of those same units when issued. Finally the inventory at the end of a year consists of the goods most recently placed in inventory. FIFO will be one of the methods used to determine Cost of Goods Sold in Openbravo.




The Openbravo instance must be in MP14 or in a later one, and must be Migrated to the new Costing Engine introduced in MP13 (By default new instances of Openbravo starting from MP13 are Migrated to the new Costing Engine).


As System Administrator the user can access to the window General Setup || Application || Module Management. There is possible to install new modules by clicking on Add Modules. Search for this module, named FIFO Costing Algorithm and install it. The system must be rebuilt after.


Once the module has been installed, the new Costing Algorithm has been created, but it has not been assigned yet to the Costing Process. To do so, the Client Administrator should go to the window Master Data Management || Product Setup || Costing Rules and create a new Costing Rule.

Click on Validate the Costing Rule to finish the setup. Now the next time that the Costing Process is run, this Costing Rule will be used, and therefore, the new costing Algorithm.


User Guide


Once the setup is complete, FIFO Costing Algorithm will be used to calculate the Cost of each Transaction. For doing so there will be two Tables: Input Stack and Output Stack. All the incoming movements, those that increases the stock, will be stored in the first table (Input Stack). The outgoing movements will consume that table and will register it on the second one (Output Stack)

Note: As indicated in New Cost Engine Documentation Manufactoring Costs are not fully implemented as of today. Therefore Manufactoring Costs can not calculated using FIFO, and they are calculated using Averange Algorithm

The Input Stack has the following fields:

The Output Stack has the following fields:

Each Input transaction will have one and only one entry in the Input Stack table.

Each Output transaction might have several entries in the output stack, each of them related to the same or different Input Stack record.

Both tables are represented in the new Tab FIFO Stacks, visible in the Product Window. In this Tab the user can see how the Transactions modify these Tables and how they are related to each other.



The example described in the Introduction section would look like this:







Advanced Scenarios

There are two scenarios that are managed a little bit different due to their complexity: Voiding documents and when negative stock is allowed.

Void a document

When a document is voided another document (so a transaction) is created to reflect this change. FIFO Costing Algorithm manages this action in a different manner depending on the type of the transaction: Incoming or Outgoing.

When an Outgoing Transaction is voided, the FIFO Stack reflects this movement. For doing so each Stack is modified.

A new row is created in the Output Stack with negative quantity and cost. The related Input Stack rows that were consumed by the original transaction are updated, increasing the Remaining Quantity and the Remaining Cost by the same amount that was originally consumed. This way both Stacks are in a status similar as if the original Transaction never happened.

Following the previous example, the first Shipment is voided. Notice that the related Input Stack is updated and its Remaining Quantity and Remaining Cost are restored.


In a similar way, when an Incoming Transaction is voided, both Stacks need to be updated. A new line is inserted in the Outuput Stack with the Quantity and Cost set with the remaining of the original Input Stack row since it is pointed to it and therefore the Remaining Quantity and the Remaining Stock of the Input Stack are set to zero.

If there were Output Stack rows that consumed the Input Stack row that was voided, then a new line is inserted in the Outuput Stack consuming the next Input Stack.

Following the previous example, the last Goods Receipt is voided. Two lines are created in the Output Stack, one that consumes the Remaining Quantity of the original Input row and another that consumes the Remaining Stock of of the next Input row/s. (In blue is the Output row that consumes the Input row that is being Voided, then generating another Output to be consumed).


Negative Stock

When the option to allow negative stock is enabled, it is possible to create an Outgoing Transaction for more quantity than the available stock.

In this scenario, the FIFO Costing Algorithm is not able to calculate the cost of the Transacion, because there will be more quantity in the Output Stack than the available in the Input Stack. Therefore, this Transaction will remain in a Pending Status. Meaning that it will remain with its cost not calculated until there is an increase in the stock that allows the algorithm to calculate its cost.

In the FIFO Stacks this is reflected by an Output row that is not related to an Input row. Notice that the Cost will remain empty until there is an available Input row to consume.

Besides that, it will not be possible to validate a new costing rule until negative stock or remainder valuation is regularized.


Retrieved from ""

This page has been accessed 1,503 times. This page was last modified on 26 March 2018, at 12:42. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.