Professional Documents
Culture Documents
Data Import
General Stuff about import in OpenERP
Defining, Changing & Discovering ids
Mapping partners
Mapping contacts
Mapping products
OpenERP 6.1 Import/Export
In OpenERP, you have the possibility to import your data from other software at the only
condition that you have to export them in a CSV format from your other software.
When trying to import data in OpenERP, it is important to understand the meaning of the
different fields to be able to do the mapping between OpenERP fields and the different data
from the other software.
Process
1. Fill one element in the object in OpenERP you want to import with the field you will have
to mention in the import phase
2. Export this element and select the field you have filled in the previous step to have the
structure of the CSV file
3. Open the CSV file and fill it with all your information
4. Import your data
Important Remarks
1
OpenERP 6.1 Import/Export
many2one
When you want to put your products in a category, you have to mention only the id of the
category in the CSV file. The different categories must exist before you try to import your
product. If they are not present, you will get an error because OpenERP will try to refer to
something that isnt existing.
Note that to add a product in the category Sellable which is a child of All products category,
you have to mention in your CSV file Sellable and not All products / Sellable that is exported
from OpenERP.
To refer several categories for only one partner, you can separate with "," (separator must not
be defined as ,).
Possible errors
2
OpenERP 6.1 Import/Export
Ex: I want to import the list of partners but the columns Categories of partners and Countries
are not recognized and cant be imported. .
In fact, these columns can only be imported by id. The id is either set at a default value by
OpenERP or defined when you import the data (by the column id).
How is it possible to define or change the ids in order to have user-friendly ones?
Before importing
(in categories CSV file)
When defining the mapping between CSV columns and OpenERP fields, choose id for the
duplicated one.
Records concerning Partner Categories in the partners CSV file have to named Retailers
(retailers =name of the category) or Consumers to be imported in OpenERP as Retailers or
Consumers.
3
OpenERP 6.1 Import/Export
!!! In this case external identifiers have been defined automatically by OpenERP.
Export the list (of categories of partners) and the external identifier will appear in the CSV file, in
the column id (ex: __export__res_partner_category_1)
Change ids
(in Sales > Configuration > Sales > Data Model ( = new menu created))
4
OpenERP 6.1 Import/Export
3) In the CSV file, modify the column id by copying column name in it.
Country name = External Identifier
4) Go back to OpenERP and import the CSV file (mapping the new id column with id).
Note:
You also easily find ids of fields by going in the developer mode:
- Click on About in the top right corner,
- Click on Activate the developer mode
Now when you are on an object, go to View Log and you can see the XML ID
5
OpenERP 6.1 Import/Export
6
OpenERP 6.1 Import/Export
Values underlined are the values by default (if nothing is defined in the .CSV file)
7
OpenERP 6.1 Import/Export
Categories of product
id External id not shown in OpenERP
name Name of the category Mandatory
parent_id/id Parent Category External id!
if you have many addresses/contacts by partner: 2 files (first partners, second contacts)
First, import the partners.
Then, using a second csv file, import addresses (see Mapping contacts in OpenERP 6.1)
To refer the partner to the contact, create a column (partner_id/id) for each contact with the name of the partner.
8
OpenERP 6.1 Import/Export
An example:
id name category supplier customer ref lang address/name address/title/id address/function address/type address/street address/zip address/city address/country_id/id address/phone
The Shelve House The Shelve House Consumers False True C01 en_US Nick Howson base.res_partner_title_sir Consultant delivery Rue de Bruxelles, 40 5000 Namur base.be 3281810562
9
OpenERP 6.1 Import/Export
10
OpenERP 6.1 Import/Export
11
OpenERP 6.1 Import/Export
An example:
id name partner_id/id title/id function type street zip city country_id/id phone fax mobile email
Nick Howson Nick Howson The Shelve House base.res_partner_title_sir Consultant delivery Rue de Bruxelles, 40 5000 Namur base.be 3281810562 81562635 474545498 nhowson@sheleve-house.com
12
OpenERP 6.1 Import/Export
13
OpenERP 6.1 Import/Export
Categories of product
id External id not shown in OpenERP
name Name of the category Mandatory
parent_id/id Parent Category External id!
If you have defined categories of products, you have to start with the import of these categories before the import of products.
Otherwise the column categ_id/id of products .CSV file will not be recognized!
14
OpenERP 6.1 Import/Export
An example:
id name categ_id/id procure_method cost_method supply_method standard_price list_price default_code type uom_po_id/id uom_id/id sale_ok purchase_ok
Shelf 200cm Shelf 200cm Marketable products Make to Order Standard Price Produce 80 210.0 SHE200 Stockable Product product.product_uom_unit product.product_uom_unit True True
15