|
|
|
|
@@ -152,10 +152,11 @@ According to your need, you should use one of these 3 ways to reference records
|
|
|
|
|
|
|
|
|
|
When you use External IDs, you can import CSV files with the "External ID" column to define the External ID of each record you import. Then, you will be able to make a reference to that record with columns like "Field/External ID". The following two CSV files give you an example for Products and their Categories.
|
|
|
|
|
|
|
|
|
|
`CSV file for categories <../../_static/example_files/External_id_3rd_party_application_product_categories.csv>`_.
|
|
|
|
|
|
|
|
|
|
`CSV file for Products <../../_static/example_files/External_id_3rd_party_application_products.csv>`_.
|
|
|
|
|
:download:`CSV file for categories
|
|
|
|
|
<files/External_id_3rd_party_application_product_categories.csv>`.
|
|
|
|
|
|
|
|
|
|
:download:`CSV file for Products
|
|
|
|
|
<files/External_id_3rd_party_application_products.csv>`.
|
|
|
|
|
|
|
|
|
|
What can I do if I have multiple matches for a field?
|
|
|
|
|
-----------------------------------------------------
|
|
|
|
|
@@ -171,8 +172,7 @@ How can I import a many2many relationship field (e.g. a customer that has multip
|
|
|
|
|
|
|
|
|
|
The tags should be separated by a comma without any spacing. For example, if you want your customer to be linked to both tags 'Manufacturer' and 'Retailer' then you will encode "Manufacturer,Retailer" in the same column of your CSV file.
|
|
|
|
|
|
|
|
|
|
`CSV file for Manufacturer, Retailer <../../_static/example_files/m2m_customers_tags.csv>`_.
|
|
|
|
|
|
|
|
|
|
:download:`CSV file for Manufacturer, Retailer <files/m2m_customers_tags.csv>`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
How can I import a one2many relationship (e.g. several Order Lines of a Sales Order)?
|
|
|
|
|
@@ -181,17 +181,15 @@ How can I import a one2many relationship (e.g. several Order Lines of a Sales Or
|
|
|
|
|
If you want to import sales order having several order lines; for each order line, you need to reserve a specific row in the CSV file. The first order line will be imported on the same row as the information relative to order. Any additional lines will need an addtional row that does not have any information in the fields relative to the order.
|
|
|
|
|
As an example, here is purchase.order_functional_error_line_cant_adpat.CSV file of some quotations you can import, based on demo data.
|
|
|
|
|
|
|
|
|
|
`File for some Quotations <../../_static/example_files/purchase.order_functional_error_line_cant_adpat.csv>`_.
|
|
|
|
|
:download:`File for some Quotations <files/purchase.order_functional_error_line_cant_adpat.csv>`.
|
|
|
|
|
|
|
|
|
|
The following CSV file shows how to import purchase orders with their respective purchase order lines:
|
|
|
|
|
|
|
|
|
|
`Purchase orders with their respective purchase order lines <../../_static/example_files/o2m_purchase_order_lines.csv>`_.
|
|
|
|
|
:download:`Purchase orders with their respective purchase order lines <files/o2m_purchase_order_lines.csv>`.
|
|
|
|
|
|
|
|
|
|
The following CSV file shows how to import customers and their respective contacts:
|
|
|
|
|
|
|
|
|
|
`Customers and their respective contacts <../../_static/example_files/o2m_customers_contacts.csv>`_.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:download:`Customers and their respective contacts <files/o2m_customers_contacts.csv>`.
|
|
|
|
|
|
|
|
|
|
Can I import several times the same record?
|
|
|
|
|
-------------------------------------------
|
|
|
|
|
@@ -216,7 +214,10 @@ If you need to import data from different tables, you will have to recreate rela
|
|
|
|
|
|
|
|
|
|
To manage relations between tables, you can use the "External ID" facilities of Odoo. The "External ID" of a record is the unique identifier of this record in another application. This "External ID" must be unique accoss all the records of all objects, so it's a good practice to prefix this "External ID" with the name of the application or table. (like 'company_1', 'person_1' instead of '1')
|
|
|
|
|
|
|
|
|
|
As an example, suppose you have a SQL database with two tables you want to import: companies and persons. Each person belong to one company, so you will have to recreate the link between a person and the company he work for. (If you want to test this example, here is a <a href="/base_import/static/csv/database_import_test.sql">dump of such a PostgreSQL database</a>)
|
|
|
|
|
As an example, suppose you have a SQL database with two tables you want to import: companies and
|
|
|
|
|
persons. Each person belong to one company, so you will have to recreate the link between a person
|
|
|
|
|
and the company he work for. (If you want to test this example, here is a :download:`dump of such a
|
|
|
|
|
PostgreSQL database <files/database_import_test.sql>`)
|
|
|
|
|
|
|
|
|
|
We will first export all companies and their "External ID". In PSQL, write the following command:
|
|
|
|
|
|
|
|
|
|
|