Odoo Help


How to import several thousands of new products WITH their initial inventory? V8 Saas

michel Guénard
on 4/22/15, 5:14 PM 1,149 views

My company is about to buy the whole inventory from another company.

The only data that I cannot import thru an external file is - guess what! - the initial quantities for each product.

If anyone from this community could indicate a way to do this import I will thank him/her for ever!

The V7 release was just easy for that. V8 is a regression on this issue.

Mario Arias Badila
On 4/30/15, 9:55 PM


We created a new inventory, and then imported a csv file similar to this one...

id Inventory Reference Inventoried Location/Database Id Inventories/Location/Database ID Inventories/Product/External ID Inventories/Product Unit of Measure/External ID Inventories/Theoretical Quantity Inventories/Checked Quantity
__export__.stock_inventory_1 Initial Stock
12 12 product_6799 product.product_uom_unit 1 1

12 product_6790 product.product_uom_unit 0 0

12 product_6836 product.product_uom_unit 20 20

12 product_6864 product.product_uom_unit 20 20

12 product_6873 product.product_uom_unit 1 1

After importing the file, we had to go into the database and change the "state" of the inventory to "confirm", as rows didn't show up otherwise...

We used the "XML ID" to reference the different products and other items, as this is the easiest way to go...

Hope this helps you.

Martin Wasala
On 4/30/15, 8:08 AM

I did it a similar way for my initial import but it did not work.
Here some details about my way:

1.Imported products into product.product and product template with pictures and variations via API and xmlrpc from a csv, which worked fine. I put our internal unique code into the field "default_code" (I guess, like you did)

2.Stock Import: I added my own field to stock_location "x_location" because our coding of shelves is varchar so I cannot use xpos,ypos,zpos

3.Now, I have a second csv file which has: default_code;warehouse_id;x_location;quantity

4.For each product.product I do: SELECT id,default_code,name_template FROM product_product WHERE default_code='CODE FROM ACTUAL CSV ROW'

5.I write by API xmlrpc into stock.location the following fields: comment>'Initialimport', company_id>5, usage>'internal', x_location>'MYOLDLOCATION'

6.I write into stock.move
     'product_uos_qty' =>new xmlrpcval($value['product_uos_qty'], "string") ,
     'product_uom_qty' =>new xmlrpcval($value['product_uos_qty'], "string") ,
     'warehouse_id' =>new xmlrpcval($value['warehouse_id'], "string"),
     'state' =>new xmlrpcval('done', "string"),
     'name' =>new xmlrpcval($value['name'], "string"),
     'product_id' =>new xmlrpcval($row['id'], "string"),
     'product_uom' =>new xmlrpcval(1, "string"),
     'location_id' =>new xmlrpcval($lid_from, "string"),
     'origin' =>new xmlrpcval('Initialimport', "string"),
     'location_dest_id' =>new xmlrpcval($rowp['id'], "string")

I don´t see any stock on the products view.
What is missing?

Did you manage it for you?

Thanks Martin

Hi Martin No I haven't yet solved this issue. Below is the guideline given by an Odoo Support's consultant: ....................................... ........................................Just make a new inventory adjustment manually or by importing it. To do that: 1. Create a new inventory for all products (Warehouse>>Inventory adjustments menu) 2. Start it 3. In the list view, select your newly created inventory 4. More -> Export : Select only the field "Inventories" and the sub-fields useful (for instance Checked quantities and product). 5. In the CSV file, modify the quantities 6. Import your new inventory 7. Check your inventory on the form view and, if everything is ok, validate it. The process was not successfull because I had difficulties in mapping the correct stock location that is requested for an import I will resume this process as soon as possible; I will let you informed

AD LIBITOM, michel Guénard
on 4/30/15, 8:45 AM

michel Guénard

--michel Guénard--
| 5 5 8
--michel Guénard--

VP operations & finance Social entrepreneur Certified Public Accountant Past Chief internal auditor

michel Guénard
On 4/22/15, 5:52 PM

I will do as follows:

  • first create the product into the database with all the necessary attributes - including an internal sequential reference allowing to easily identify them after the import.

  • Exporting these newly created product to obtain their id AND their internal reference.

  • Mapping (spreadsheet)  the exported lines with the initial file used to create the products; this file contains both the internal reference for mapping and all the necessary fields for an importation of STOCK MOVES (MENU WAREHOUSE>>MOVES>>IMPORT.

The fields that seem necessary for an importation of a move are:

date location_dest_id/id location_id/id (source) product_uom

Can someones confirm that this protocol will generate the initial inventory that I need?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 4/22/15, 5:14 PM
Seen: 1149 times
Last updated: 4/30/15, 9:55 PM