跳至内容
菜单
此问题已终结
2 回复
2130 查看

I assigned as a test an External ID to my contacts, from 1 to 28, but I'm not sure if individual contacts who work for one of the affiliated companies should be given the same External ID as the company or if I should assign them a different External ID (as long as that company is also in this contact template). If the contact does not belong to any company, I understand that they should be assigned their own External ID individually.


Version 18.0+e

形象
丢弃
最佳答案

External ID's do not have to be assigned.

They are only used if you import or export data.

If you import data, you supply the External ID so that Odoo knows if it should create or update during import. If it can't find the External ID, it will create a new record when it imports that line. If I can find the External ID, it will update an existing record when it imports that line.

If you export data, with " I want to update data (import-compatible export)" checked, Odoo will assign an External ID automatically.

If you are not importing or exporting data, you don't need to worry about External ID at all.

The External ID field has two pieces, a prefix and a suffix, separated by a period (.) - and they must be unique. For this reason we recommend using the name of the model and a number, with perhaps the first piece being the name of the External software you are importing from. 

When Odoo assigns an External ID, it will always use __export__ as the prefix and the name of the model in the suffix (followed by a number and a UUID hash).

See also https://www.odoo.com/documentation/18.0/applications/essentials/export_import_data.html#import-from-another-application


Both the Company and the Contact need their own External ID. The Contact is the linked to the Company via the parent_id field. Don't forget the Is a Company field:


Example import:


Mapping during import:

形象
丢弃
最佳答案

To the best of my knowledge, external ID should be unique or at least unique per module. (I don't have a system on hand now to check if there is a unique key on the external ID). But from the fact that we normally access an external ID by using module.external_id, I think it must be unique. 

But you can always name your external id more creatively instead of using number such as:

user_contact_xxxx: for users
free_as_a_bird_contact_xxxx: for contacts not belong to any company
company_id_paycheck_earner: for those who work for a company.

形象
丢弃
相关帖文 回复 查看 活动
1
5月 25
973
1
3月 25
1199
1
2月 25
1588
2
2月 25
1776
1
11月 24
2197