The Product Cost FIFO Module add a FIFO option in the Cost Method field of the product form.
The cost price of product whose cost price method is FIFO will be updated automatically when stock moves coming from a supplier or going to a customer are made. The page FIFO and LIFO accounting on Wikipedia gives some information about this costing method.