Import records when the company moves to the new system
When the company moves from another system to Odoo, the administrator brings the customers and vendors from a spreadsheet. Odoo links each column to its field, validates the CNPJ as in the manual registration, tests and creates the contacts. In the next load, with the corrected spreadsheet, the external ID makes Odoo update the contacts instead of creating others.
Before you start
Have the spreadsheet of the previous system, in CSV or spreadsheet format, with a header and one contact per row: external ID, name, CNPJ, phone, whether it is a company and whether it is a customer or a vendor. The CNPJ must be valid and not repeated in the database, and the header can use the labels of the Odoo fields. The state registration goes in another column of the same file, when the contact has one. The example is Guatambu Móveis e Utilidades Ltda, which loads three customers (Canjerana Móveis Comércio, Timbaúva Móveis e Decorações and Bracatinga Móveis) and three vendors (Guaçatonga Ferragens e Estamparia, Distribuidora Vereda Grande and Pitangueira Distribuidora de Utilidades). This applies in Brazil as it is: the CNPJ goes through the same validation as the manual registration (check digits) and the import saves only the digits.
Step by step
1. Check the spreadsheet
Check that each row has one contact, with external ID, CNPJ, phone and the mark of customer or vendor. The example spreadsheet has 6 rows of data and 8 columns, including the tag Carga da virada.
2. Open the import and load the file
Open the Contacts app, click the gear next to the title and choose Import records. Click Upload data file and choose the spreadsheet. Odoo links each column to its field: check the mapping. If a column has no field, choose the field in the list of the column or rename the header of the file.
3. Test before saving
Click Test: the message Everything seems valid confirms the rows. If a row has a problem, such as an invalid CNPJ, the test points it out and nothing is saved while there is an error: fix the value in the file and upload it again.
4. Import the contacts
Click Import and go to the list: the six contacts come in, with the CNPJ and the phone, three customers and three vendors.
5. Correct the spreadsheet and load it again
In the check of the load, the phone of Timbaúva and the one of Pitangueira were wrong: fix them in the spreadsheet (Timbaúva from (51) 3341-7250 to (51) 3341-7259 and Pitangueira from (31) 3412-6580 to (31) 3412-6850), keeping the same external IDs. Repeat the import: gear, Import records, Upload data file, Test and Import. Odoo recognizes the external ID and updates the contacts instead of creating others.
6. Check the list
Open the list of contacts: there are still six contacts, with no duplicates, and the two phones were updated.
Expected result
Six contacts (three customers and three vendors) imported from the spreadsheet with the CNPJ validated, and updated by the same corrected spreadsheet with no duplicates: there are still six, with the phones of Timbaúva and Pitangueira corrected.
If something goes wrong
If the test shows an error in a row, such as an invalid CNPJ, the row does not pass the validation of the registration: fix the CNPJ in the spreadsheet and upload again. If, after the second load, repeated contacts appear, the External ID column was imported empty or with values different from the first load: archive the repeated ones, check that the external ID of the spreadsheet is the one of the first load and import again. If the import refuses a duplicated CNPJ, the CNPJ already exists in the database in a contact without that external ID: remove the row from the spreadsheet or give the existing contact the same external ID and import again.
Odoo 18 manual
Standard Odoo 18 features used in this task, from the official manual.
