It is very important for the warehouses to be able to track the products that are stored or have left the warehouse by products’ serial numbers. This feature enables reviewing the state of a specific product - the reason and time it left the warehouse, in which warehouse it has been stored and to which it has been moved, and so on.
A solution to that problem could be a new model 'Serial Number' which will keep track of all this activity relating the existing 'Stock Move' model. Since 'Stock Move' already relates to a shipment and to a product and represents a product movement from or to the warehouse, we have all the information we need.
The new model 'Serial Number' ('stock.move.serial_number') will have the fields:
serial_number -> (string)
input_move -> (Many2One relationship with stock.move)
output_move -> (Many2One relationship with stock.move)
Every time a product enters the warehouse it gets a serial_number and the input_move relationship links to the input stock move.
When the product leaves the warehouse, the output_move of the serial number links to the output stock move.
Here is a repository of the module: