Hoe gegevens importeren in Odoo

Hoe starten

U kunt gegevens importeren in elk Odoo’s business object met behulp van Excel (.xlsx) of CSV (.csv) bestanden: contactpersonen, producten, bankafschriften, journaalboekingen en zelfs bestellingen!

Open de weergave van het object dat u wilt opvullen en klik op Importeer.

../../../_images/import_button.png

Daar vindt u sjablonen die u gemakkelijk kunt invullen met uw eigen gegevens. Dergelijke sjablonen kunnen met één klik worden geïmporteerd; De data mapping is reeds gedaan.

Hoe de template wijzigen

  • Voeg kolommen toe, verwijder ze en soort ze zodat ze zo goed mogelijk bij uw datastructuur passen.

  • We adviseren u om het veld ID niet weg te halen (waarom ziet u in de volgende sectie).

  • Stel een unieke ID in voor elke record door de ID sequentie naar beneden te slepen.

../../../_images/dragdown.gif
  • Wanneer u een nieuwe kolom toevoegt, kan Odoo het mogelijk niet automatisch toewijzen als het label in Odoo niet als een bestaand veld herkend wordt. Maar geen zorgen! U kunt nieuwe kolommen handmatig toewijzen wanneer u de import test. Zoek in de lijst naar het overeenkomstige veld.

    ../../../_images/field_list.png

    Gebruik vervolgens dit veld zijn label in uw bestand om het de volgende keer direct te doen werken.

Hoe importeren vanuit een andere applicatie

In order to re-create relationships between different records, you should use the unique identifier from the original application and map it to the ID (External ID) column in Odoo. When you import another record that links to the first one, use XXX/ID (XXX/External ID) to the original unique identifier. You can also find this record using its name but you will be stuck if at least 2 records have the same name.

The ID will also be used to update the original import if you need to re-import modified data later, it’s thus good practice to specify it whenever possible.

Ik kan het veld niet vinden dat ik wens te koppelen aan mijn kolom

Odoo tries to find with some heuristic, based on the first ten lines of the files, the type of field for each column inside your file. For example if you have a column only containing numbers, only the fields that are of type Integer will be displayed for you to choose from. While this behavior might be good and easy for most cases, it is also possible that it goes wrong or that you want to map your column to a field that is not proposed by default.

Wanneer dat gebeurt, dien je gewoon de Tonen van velden van relatie velden (geavanceerd) optie aan te vinken, vervolgens zal je de mogelijkheid hebben om te kiezen uit de complete lijst van velden voor iedere kolom.

../../../_images/field_list.png

Waar kan ik het datum invoerformaat wijzigen?

Odoo can automatically detect if a column is a date, and it will try to guess the date format from a set of most commonly used date formats. While this process can work for many date formats, some date formats will not be recognized. This can cause confusion due to day-month inversions; it is difficult to guess which part of a date format is the day and which part is the month in a date such as ‘01-03-2016’.

To view which date format Odoo has found from your file you can check the Date Format that is shown when clicking on Options under the file selector. If this format is incorrect you can change it to your liking using the ISO 8601 to define the format.

Notitie

If you are importing an excel (.xls, .xlsx) file, you can use date cells to store dates as the display of dates in excel is different from the way it is stored. That way you will be sure that the date format is correct in Odoo whatever your locale date format is.

Kan ik nummers importeren met een valuta-teken (bvb.: $ 32,00)?

Yes, we fully support numbers with parenthesis to represent negative sign as well as numbers with currency sign attached to them. Odoo also automatically detect which thousand/decimal separator you use (you can change those under options). If you use a currency symbol that is not known to Odoo, it might not be recognized as a number though and it will crash.

Voorbeelden van ondersteunde cijfers (gebruikt 32000 als voorbeeld):

  • 32.000,00

  • 32000,00

  • 32,000.00

  • -32000.00

  • (32000.00)

  • € 32.000,00

  • (32000.00 €)

Voorbeeld dat niet werkt:

  • ABC 32.000,00

  • € (32.000,00)

Wat kan ik doen als de tabel Importeervoorbeeld niet correct wordt weergegeven?

By default the Import preview is set on commas as field separators and quotation marks as text delimiters. If your csv file does not have these settings, you can modify the File Format Options (displayed under the Browse CSV file bar after you select your file).

Als uw CSV-bestand een tabellering heeft als scheidingsteken zal Odoo de scheidingen niet detecteren. U moet de bestandsindeling opties wijzigen in uw spreadsheet applicatie. Zie de volgende vraag.

Hoe kan ik het CSV bestandsformaat wijzigen wanneer ik deze bewaar in de spreadsheet applicatie?

If you edit and save CSV files in speadsheet applications, your computer’s regional settings will be applied for the separator and delimiter. We suggest you use OpenOffice or LibreOffice Calc as they will allow you to modify all three options (in ‘Save As’ dialog box > Check the box ‘Edit filter settings’ > Save).

Microsoft Excel will allow you to modify only the encoding when saving (in ‘Save As’ dialog box > click ‘Tools’ dropdown list > Encoding tab).

Wat is het verschil tussen Database ID en Extern ID?

Some fields define a relationship with another object. For example, the country of a contact is a link to a record of the ‘Country’ object. When you want to import such fields, Odoo will have to recreate links between the different records. To help you import such fields, Odoo provides 3 mechanisms. You must use one and only one mechanism per field you want to import.

Bijvoorbeeld, om te verwijzen naar het land van een contactpersoon, stelt Odoo u 3 verschillende en importeerbare velden voor:

  • Land: de naam of code van het land

  • Country/Database ID: the unique Odoo ID for a record, defined by the ID postgresql column

  • Country/External ID: the ID of this record referenced in another application (or the .XML file that imported it)

Het land België kunt op één van deze drie manieren importeren:

  • Land: België

  • Land/Database ID: 21

  • Land/Externe ID: base.be

According to your need, you should use one of these 3 ways to reference records in relations. Here is when you should use one or the other, according to your need:

  • Gebruik land: Dit is de makkelijkste manier wanneer uw gegevens komen vanuit een CSV bestand dat handmatig is aangemaakt.

  • Use Country/Database ID: You should rarely use this notation. It’s mostly used by developers as it’s main advantage is to never have conflicts (you may have several records with the same name, but they always have a unique Database ID)

  • Gebruik Land/Externe ID: Gebruik externe ID wanneer u data importeert vanuit een externe applicatie.

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.

CSV file for Products.

Wat moet ik doen als ik verschillende matches heb voor een veld?

If for example you have two product categories with the child name “Sellable” (ie. “Misc. Products/Sellable” & “Other Products/Sellable”), your validation is halted but you may still import your data. However, we recommend you do not import the data because they will all be linked to the first ‘Sellable’ category found in the Product Category list (“Misc. Products/Sellable”). We recommend you modify one of the duplicates’ values or your product category hierarchy.

Maar als u de configuratie van de productcategorieën niet wilt wijzigen, raden wij u aan gebruik te maken van de externe ID voor dit veld ‘Categorie’.

Hoe kan ik een many2many relatieveld importeren (bijvoorbeeld een klant met meerdere labels)?

Labels moeten gescheiden worden door een komma zonder enige spatie. Bijvoorbeeld, als u een klant zowel het label ‘Fabrikant’ als ‘Retailer’ wil geven, dan moet u zowel ‘Fabrikant, Retailer’ in dezelfde kolom ingeven in uw CSV bestand.

CSV file for Manufacturer, Retailer

Hoe kan ik een one2many relatie importeren (bijvoorbeeld verkooporderlijnen op een verkooporder)?

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 additional 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.

Het volgende CSV bestand toont u hoe u aankooporders met hun respectievelijke aankooporderlijnen importeert:

Purchase orders with their respective purchase order lines.

Het volgende CSV bestand laat zien hoe klanten en de bijbehorende contactpersonen te importeren:

Customers and their respective contacts.

Kan ik meerdere malen hetzelfde record importeren?

If you import a file that contains one of the column “External ID” or “Database ID”, records that have already been imported will be modified instead of being created. This is very useful as it allows you to import several times the same CSV file while having made some changes in between two imports. Odoo will take care of creating or modifying each record depending if it’s new or not.

Deze optie geeft u de mogelijkheid om de importeer en exporteer functie van Odoo te gebruiken voor het bewerken van een hele reeks record in uw favoriete spreadsheet applicatie.

Wat gebeurd er als ik geen waarde voor een specifiek veld ingeef?

Als u niet alle velden in uw CSV file een waarde geeft, zal Odoo de standaard waarde voor ieder niet-gedefinieerd veld gebruiken. Voor velden zonder waarde in de CSV file, zal Odoo het veld LEEG maken, in plaats van het veld de standaard waarde toe te kennen.

Hoe verschillende tabellen exporteren/importeren vanuit een SQL applicatie naar Odoo?

Als u gegevens moet importeren van verschillende tabellen, dient u de relaties tussen de records van de verschillende tabellen aan te maken. (bijv. als u bedrijven en personen importeert dient u de koppeling tussen ieder persoon en het bedrijf te maken.

Om relaties tussen tabellen te beheren, kunt u gebruik maken van de “Externe ID” van Odoo. Deze “externe ID” van een record is de unieke identificatie van dit record in de andere applicatie. Deze “Externe ID” moet uniek zijn bij alle records en alle objecten. Het is daarom verstandig om de externe ID te voorzien van een voorvoegsel, met de naam van de applicatie of de tabel (zoals ‘bedrijf_1’, ‘persoon_1’ in plaats van alleen ‘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 dump of such a PostgreSQL database)

We zullen eerst alle bedrijven en hun “Externe ID” exporteren. In PSQL, schrijf het volgende commando:

> copy (select 'company_'||id as "External ID",company_name as "Name",'True' as "Is a Company" from companies) TO '/tmp/company.csv' with CSV HEADER;

Dit SQL commando zal het volgende CSV bestand genereren:

External ID,Name,Is a Company
company_1,Bigees,True
company_2,Organi,True
company_3,Boum,True

Om het CSV bestand aan te maken voor contacten, gekoppeld aan bedrijven, gebruiken we het volgende SQL commando in PSQL:

> copy (select 'person_'||id as "External ID",person_name as "Name",'False' as "Is a Company",'company_'||company_id as "Related Company/External ID" from persons) TO '/tmp/person.csv' with CSV

Het genereert het volgende CSV bestand:

External ID,Name,Is a Company,Related Company/External ID
person_1,Fabien,False,company_1
person_2,Laurence,False,company_1
person_3,Eric,False,company_2
person_4,Ramsy,False,company_3

As you can see in this file, Fabien and Laurence are working for the Bigees company (company_1) and Eric is working for the Organi company. The relation between persons and companies is done using the External ID of the companies. We had to prefix the “External ID” by the name of the table to avoid a conflict of ID between persons and companies (person_1 and company_1 who shared the same ID 1 in the original database).

De twee aangemaakte bestanden zijn gereed om te worden geïmporteerd in Odoo, zonder enige aanpassing. Na het importeren van deze twee CSV bestanden heeft u 4 contactpersonen en 3 bedrijven. (De eerste 2 contactpersonen zijn gekoppeld aan het eerste bedrijf). U dient eerst de bedrijven en dan de personen te importeren.