Reference field in Odoo can be used for storing an arbitrary reference to a model.
This field allows us to select a model and adding a reference to that model. Reference fields are mainly used for showing different model's records as reference in your record.
For example, if you have a model contains various fields and if the records of that model are created from existing models such as Sales order, Purchase Order, Invoice, Project, Voucher etc. and if you need a reference of the model from which your record has been created in your model, then you can use a field of type reference which stores a link to the model from which your record is created.
Reference field stores both the model name and the selected reference id. Reference field have a selection list which is a list of tuples with model and name and list of records of the selected model.
Second area of reference field allows us to select a record of the selected model.
Reference field act like a many2one to the model selected.
In the db reference field stores both the model name and the id of the record selected.
For the above example reference field value will be ‘sale.order,<id>’
We can access the data of a reference field as like from normal many2one field.
For example: ‘field_name.name’ can be used for getting the name of the record selected if field_name is the name of field of type reference.
A reference field can be declared as below.
Above declaration allows us to select models that have added as referencable models. We can also modify the selection of reference field to select the models as per our requirement.
Referencable Models can be added using the menu Settings -> Technical -> Database Structure -> Referencable Models. We can also give the priority of the model in the reference selection.
We can also define the list of models in the reference selection.
Above function lists all the models in the selection of reference rather than the models added in Referenceable Models menu.
Hope my presentation was usefull for you .