Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Import contacts through CSV

By
Gerard
on 6/30/14, 6:37 AM 2,044 views

Hello,

I have a list of companies in OpenERP 7 with external IDs. Now I want to import their contacts (different csv), but I can't find how to make the relation based on the External ID.

For example i want to import two contacts that belong to company 1. (one-to-many). I tried the following...

"Company / External id","Name","Is a Company"

1,"Person A", "false"

1,"Person B","false"

But sadly no success... can anyone please help me.

0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 6/30/14, 6:41 AM

New answer, based on a real life example. This is a simple export from an exisiting database that already had a company and PersonA under that company. Based on the situation you provided, you will only have the first line (id 183, Company1) and need to provide the second line. This is how it should look:

  • "id", "name", "is_company", "parent_id/id", "company_id/id"
  • "__export__.res_partner_183", "Company1","True","","base.main_company"
  • "__export__.res_partner_184","PersonA","False","__export__.res_partner_183","base.main_company"

Of course, you need to replace the actual ID (183 / 184) with your own id's. Note that the parent_id/id field on the first line is actually empty, since it does not have a parent id.

1
Gerard
On 6/30/14, 8:50 AM

Solved:

'parent_id/id' is the same as 'Related Company / External ID' from the pull-down.

File A
"ID","Is a Company","name"
"1","True","Company 1"

File B
"id","name","parent_id/id"
"","Person A","1"
"","Person B","1"
"","Person C","1"

I see. The external id is than used for your own company (in the case of a multi-company setting for example). Try to look for "parent_id" on the record instead. Fill in the "__res.... etc." id in that field and you should be fine. Leave the ID field of the new contact persons empty. If it is empty, it will supply the default values for it.

Ludo - Neobis
on 6/30/14, 10:03 AM

Hi Ludo, Thanks again for the quick answer. I went back to basic and started with a fresh install (only the CRM module) to replicate your example. Your first line "__res.partner__.4", "My customer comp" gave an error "Too many dots". :( Can you help out with a working example? I have been at it for a week now and it's driving me nuts. Your help is much appreciated .

Gerard
on 7/1/14, 5:10 AM

I modified my original answer, see above.

Ludo - Neobis
on 7/1/14, 5:45 AM

We are on the same track. I have exported some demo-content and got the same indentifiers. The problem is now which field do I select from the pull-down (screenshot: http://snag.gy/wRY8P.jpg)

Gerard
on 7/1/14, 6:02 AM

I do not know how you import your files, but in general I export a file using the setting "Import compatible", manipulate that file and then at the partner list view use the "Import" button, next to the "Create" to import a file. Simply select the file, click on "Validate" and it shows you a green bar if it could find anything. The only important thing is that you always leave the header of the file intact, because that should show the fields to import. Got no "Import" option next to the Create button? Go to Settings --> Configuration --> General and check the box "Allow users to import data using CSV files" and press apply.

Ludo - Neobis
on 7/1/14, 6:22 AM

That's my way of importing and exporting as well... The only thing missing... is the parent_id... Maybe I was too frustrated to see it, but 'parent_id/id' is the same as 'Related Company / External ID' from the pull-down. Now it works!!! Thank you for your support and patience.

Gerard
on 7/1/14, 7:25 AM

You are welcome. If it helped you, mark the answer as correct.

Ludo - Neobis
on 7/1/14, 7:51 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 6/30/14, 6:37 AM
Seen: 2044 times
Last updated: 3/16/15, 8:10 AM