Thursday, July 3, 2014

Import and Export in Odoo V8

In order to be able to export/import we have to go to Settings->Configuration->General settings. check the box "Allow users to import data from CSV files" and apply the change.

Now let's see an example of import/export a product:

Go to any products view and change it to "list view", for some reason Kanban View and Form View do not have import/export as an option.

You will only see "Import" in "list view" if you don't choose any product. For export, first choose some or all products by choose the check box(s) in left, then click "more" button on top of the view, choose "Export" from there.

Export:
After click Export, set export type to be "import-compatible Export", choose Export Formats as "CSV".

Import: 
My suggestion: It's better you check the export file to make sure your import file is based on the columns you need):

To use import to create a new record: 
Although your first field will always be ID, be sure to leave that empty when you are importing so ERP will assign IDs to your items instead of using your items to overwrite the fields on existing items.
when you choose your file to improt be sure to click "file format options", if the encoding is UTF-8 change it to latin1 so it can accept a wider variety of characters like the degree symbol and the like.

So how to load a new product that has multiple variants and variants values? Here is an example(copy those in blue and open as csv file to see better format):


Products / External_id,cost_method,categ_id/id,valuation,name,type,Products / Product Attributs / Attribute,Products / Product Attributs / Product Attribute Value,uom_po_id/id,uom_id/id
,Standard Price,product.ipad,Periodical (manual),iPad Retina Display Duplicate3,Stockable Product,Memory,"16 Go,32 Go",product.product_uom_unit,product.product_uom_unit
,,,,,,Color,"White,Black",,
,,,,,,Wi-Fi,2.4 GHz,,

I will explain the structure of this a little bit:
Products / External_id will be empty for new product
Products / Product Attributs / Attribute is for attribute
Products / Product Attributs / Product Attribute Value: You can put multiple values there, but when you do that, using comma(,) to seperate values. e.g. "16 Go,32 Go". Odoo will not create new attribute values when import product, you only can put the value existing in Odoo.

Even though it has multiple records for one product, Odoo know how to deal with it. Be sure only the first line has product's other information, and Odoo know the following lines is for the product of first line. And be sure to define the right column mapping information when load the variants' attributes and attributes values.

To use import to update a record: 
The only difference is you need to add a reference so Odoo know that is to update a record, not create a new record. My suggestion is use id from the export to identify the records you need to import, be aware that id is called External_id when you import.

8 comments:

  1. Very Good article, can you post one for creating new fields for products?

    ReplyDelete
    Replies
    1. Hi Aftab, I will do it later, am working on another ERP system recently. Thanks for your comments!

      Delete
  2. Hi, and nice article. Your instructions are good but I have run into an issue on a new install where the product_variant_ids/id is requiring some data (__export__.product_product_16518 for example) but these are new products and there is no external id for these products yet? any idea? cheers!

    ReplyDelete
  3. Thank You! It's refreshing to find useful information about odoo/openerp after pouring through thousands fake-help sites written by Indian scammers who mislead people so they can charge them for "consulting". Again, thank you sir.

    ReplyDelete
  4. Sir please tell me about how can i hide delete button from Export data from view in odoo. Delete button that i want to hide is appeared with saved exports.

    ReplyDelete
  5. Sir please tell me about how can i hide delete button from Export data from view in odoo. Delete button that i want to hide is appeared with saved exports.

    ReplyDelete
  6. how about pricelist ? i can't add nor update the fixed price on pricelist.

    ReplyDelete