This question has been flagged
2 Replies
3989 Views

Hello everyone,

I've imported a bunch of companies with a csv file. All good and fine. In the next import I want to import the contacts or employees of those companies. So to get the matching field / ID - I have exported the companies with all available IDs into an csv file. 2 IDs are available, external ID and ID. I've tried both numbers when importing the contacts. Doesn't work.

So how can I import the contacts and match them with the corresponding company?

Avatar
Discard
Author

Since I've got a bunch of companies with the same "Name" but different location or addresses, I would need an ID to match instead of a simple name.

The import is working, but only if a set the company name in the contacts/employee csv and set related Company to that field when importing. What if I want to match it with the company with the same name, but with other address?

Best Answer

You have already imported all the companies. Now export the external ID and name of all the companies and map the contact information with it. Then import it. You are doing it right. Try it again please and use external ID.

Hope it helps..!!


Steffy

Trainee Odoo Consultant

Tel: +353 1 886 5684 (IE) +44 121 285 5684 (UK)  +91 124 634 5684 (IN)

 

Target Integration | CRM ERP Cloud

Website | LinkedIn | Twitter | Facebook | Youtube | Instagram

Attachments area
Avatar
Discard
Author Best Answer

Since I've got a bunch of companies with the same "Name" but different location or addresses, I would need an ID to match instead of a simple name.
The import is working, but only if a set the company name in the contacts/employee csv and set related Company to that field when importing. What if I want to match it with the company with the same name, but with other address?

Avatar
Discard
Author

Hello Steffy.

thanks for your fast response. The external ID looks like this:

__import__.36

Do I have to alter/modify this ID?

MAPPING:

Related Company -> company name

External ID -> external_ID

ERROR

Unknown error during import: <class 'odoo.exceptions.ValidationError'>: You cannot create recursive Partner hierarchies. at row 2 (Contact Name)

Resolve other errors first

MAPPING:

External ID -> related Company

No matching record found for name '__import__.36' in field 'Related Company' at row 2 (Daniela Blums)

See possible values

Hello,

You have imported all the companies in the contact. Now select all the companies you want to export and then select the fields i.e. "External ID" and "Display name". You will get the sheet including External ID and display name. Edit the sheet and update contact names against the companies which you want to import. You can name the column "Contact/Name" or "child_ids/name" for the contacts. Now import it and map External Id column with "External ID" and Contacts column with "Contact/name". You do not need the column with companies name but if you want you can map the column that has name of the companies with "Company name" and not the "Related company". Now you have 3 columns:-

Company name

External ID

Contact/name

Try to import in the above mentioned scenario.

Hope it helps..!!

Steffy

Junior Odoo Consultant

Tel: +353 1 886 5684 (IE) +44 121 285 5684 (UK) +91 124 634 5684 (IN)

Target Integration | CRM • ERP • Cloud

Website | LinkedIn | Twitter | Facebook | Youtube | Instagram

Author
Thanks for your reply.

That procedure is not working, or I am  missing something.

I import 3 test companies. Two of them have the same name (TestCompany 2), but different addresses. 

ID
COMP-001	COMP-002	COMP-003

name
TestCompany 1	TestCompany 2	TestCompany 2

address
Street 1	Street 2	Street 3



If i than export those records I get:

External ID
__import__.COMP-001	__import__.COMP-002	__import__.COMP-003

ID
125846		125847		125848



So now I want to import 2 contacts, both should appear at TestCompany 2 with the external ID COMP-003
They should not appear at TestCompany 2 with external ID COMP-002

If I try the way you describe it, TestCompany 3 is deleted or overwritten/updated and only get 1 Contact (The last one). No Contact is matched to any Company.


My question is what fields can I use for the

Primary Keys - Foreign Keys

What's the primary key for companies to use?
What field is the foreign key when importing contacts?


All the best and thank you very much for your time already.

Cheers!


On 25.02.2021, at 12:21, Steffy <steffy@targetintegration.com> wrote:

View Forum Post	
Hello,

You have imported all the companies in the contact. Now select all the companies you want to export and then select the fields i.e. "External ID" and "Display name". You will get the sheet including External ID and display name. Edit the sheet and update contact names against the companies which you want to import. You can name the column "Contact/Name" or "child_ids/name" for the contacts. Now import it and map External Id column with "External ID" and Contacts column with "Contact/name". You do not need the column with companies name but if you want you can map the column that has name of the companies with "Company name" and not the "Related company". Now you have 3 columns:-

Company name

External ID

Contact/name

Try to import in the above mentioned scenario.

Hope it helps..!!

Steffy

Junior Odoo Consultant

Tel: +353 1 886 5684 (IE) +44 121 285 5684 (UK) +91 124 634 5684 (IN)

Target Integration | CRM • ERP • Cloud

Website | LinkedIn | Twitter | Facebook | Youtube | Instagram

Sent by Odoo S.A. using Odoo.