Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
757 Prikazi

Hi everyone,

I've already imported a list of companies into Odoo CRM Contact list using is_company = 1. Now I want to import contact data who work at this company. But when I use their company's name as "Related Company" it always returns this error 
Unknown error during import: <class 'json.decoder.JSONDecodeError'>: Expecting value: line 1 column 1 (char 0) at multiple rows
Here are some things I've tried to fix the problem:

  1. The problem isn't from any other fields. If I remove the related company field, there are no more errors. 
  2. I'm not quite sure if I'm using the right field for linked companies. If I use "Company" instead of "Related Company", it just says No matching records found for the following name in field Company despite all the companies being available in the database and can be looked up in Odoo. 
  3. I've also tried converting to csv and importing that instead, same error.
  4. I've removed all filters/formatting in the original excel files before importing
  5. This is a very small subset of my full data. Only 300 contacts out of 40k 

Thanks everyone in advance 😅

Avatar
Opusti

I'm sorry you haven't seen any answers yet, I'm going to try this and I'll report back. I think maybe this might work better using the numerical key field to connect the child record (contact) to the parent record (company). We'll see.

Best Answer

Your import file needs to look like this:


id email phone name is_company parent_id

office@acme.com 1111111111 ACME 1

person@acme.com 1111111111-22 Person 0 ACME


You'll end up with two Contact-records, one of type Company, one of type Individual:


Alternatively, you can have two import files if you wish to do so. First one to import all the Company type Contacts, second one to import all the Individuals:

File 1:

id email phone name is_company parent_id

office@acme2.com 1111111111 ACME2 1


File 2:

id email phone name is_company parent_id

person@acme2.com 1111111111-22 Person 0 ACME2


The easiest way to identify how an import file is supposed to look like is to create a set of records with the structure desired and then export them (with the flag I want to update data (import-compatible export) set to 'true'). This way you can play around with the available fields until you see a structure that makes sense and try to import it.

See also https://www.odoo.com/documentation/18.0/applications/essentials/export_import_data.html - in here, at Import one2many relationships you can actually find an example for your exact requirement (Customers and their respective contacts).

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
jun. 25
1002
1
sep. 24
3021
1
avg. 24
1392
1
avg. 24
1584
0
mar. 24
982