Odoo Help


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.


Showing External ID on forms

on 7/2/14, 5:43 PM 1,345 views

As a newbe I'm trying to import records from our 3rd party system into Odoo. We use our IDs as our main reference for records for example a customer within the company woukd be refered to as file number (1245) as well as by name, the same applys to a product e.g. id (20152) rather than its code or description. I note Odoo offers the facility to 'map' external ids using ir.model.data during the csv import which I understand and have done successfully. However we would need to show these external IDs when displaying the customer / product records whilst maintaining the ir.model.data mapping so we can update records in future.

The question is what would be the best method of achieving the above: 

1) To write a custom module to get the value via ir.model.data and expose it to the form (assuming there is not a simpler method of retrieving the external ID and displaying it) ?

2) To create a custom field and populate this with the external ID (effectively duplicating the data) and add it to the form. This seems simpler but somehow not the cleanest?


Why don't you use the Reference (ref) field of a partner and Internal Reference field (default_code) of a product and supply the same External ID there? Those fields are already part of every partner and product record and are already shown on the relevant form views.

Bista Solutions US, Ray Carnes
on 7/3/14, 7:43 PM
Daniel Blanco
On 8/27/16, 8:10 AM

You should enter debug mode, go to a form view of the record you want to know the external id, and choose "view metadata". Then under XML ID you will find it

Hieu Nguyen
On 11/18/15, 2:03 AM

To get External IDs, you can use this method get_external_id ( cr , uid , ids , *args , **kwargs ) or get_external_id () (in Odoo 8/9).

To display it, you may need to create a computed field:

ext_id = fields.Char(compute='get_external_id')

(this is an example for Odoo 8)

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

2 follower(s)


Asked: 7/2/14, 5:43 PM
Seen: 1345 times
Last updated: 8/27/16, 8:10 AM