コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
10184 ビュー

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.

アバター
破棄
最善の回答

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.

アバター
破棄
著作者 最善の回答

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.

著作者

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 .

I modified my original answer, see above.

著作者

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)

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.

著作者

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.

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

関連投稿 返信 ビュー 活動
3
6月 20
3042
1
11月 18
8491
11
2月 17
62414
4
11月 24
10125
2
11月 24
36909