Search code examples
odooopenerp-7

Inventory on OpenERP


I need to make a comparison between two inventories, but I have 6000 products, and I want to get the stocks from the database, to make my comparison faster. The problem is that I could not find the table on the database with this information.

I found on the option "developer mode" that the table is stock_inventory_line but in this table only have the physical inventory that I put, but not the current stocks.


Solution

  • I assume from the tags on the question you are using openerp 7 you are going to need stock.move, not stock.inventory (stock.inventory is for doing stock takes or stock adjustments as you noted).

    You are going to need to mimic the qty_available and virtual_available fields as defined in stock/product.py. These are functional fields and are not stored on the database as is.

    To get the stock in a location you basically add up all the stock moves with a destination location (locn_dest_id) of your location and state of done and subtract all the stock moves with a source location (location_id) of your location and state of done.

    If you are 8, the table is stock.quant and you just add up all the entries in your location.