Published in


Reference Fields in Odoo

Odoo has different types of fields like Character, Integer, Boolean, etc. Also, have the relational fields which help to create relationships between different models. A reference field will help to create a dynamic relationship in a model. Which means we can select the model dynamically to create the relation. In Many2one, One2many and Many2many fields we can pre-define the target model in which the relationship needs to be created. For example, in a Sale Order, if we create a Many2one field to Customers, it will only create a relation between these two models, here we pre-define the target model that is customers.

In the case of the reference field first, we can select the target model and then select the record. For example, In Customer model I need to add a field ‘Document Source’, In this, for some customers, I need to add a Purchase Order as document source, for some other customers need to add Sale Order as source, and also sometimes I may need to add an Invoice as the source. In this case, I can define a reference field, so I can first choose the model (Purchase, Sale, or Invoice) and then select the record.

We can see a simple example of a reference field from Settings >> Technical >> Menu Items.

If we try to create a Menu Item from here, we have to choose an Action for this menu. This Action field is a Reference Field. Because first, we have to select the action model, ie have to select whether it is an ir.actions.the report, ir.actions.server, ir.actions.act_window, etc. After selecting that, we can select the particular action of the selected model.

After selecting the model it will show another field to choose the records in the selected model.

After saving, it will show as a single field (only the record) like a Many2one field.

Continue Reading…

Originally published at Reference Fields in Odoo




We are Odoo Gold Partners standing par excellence in Odoo implementation, customization and allied services. We do Source code sale, Custom software development, and Employee outsourcing.

Recommended from Medium

Creating a Secure Django RestFUL API

The 10 Puzzle Pieces of an Effective Microservice Architecture

Dealing with outliers in dataset(Python).

Difference between Searching and Sorting Algorithms

Better application logging on AWS Lambda

Pickle Rick

An Introduction to using tcpdump at the Linux command line

Learn Flutter SDK and keep yourself updated in the race of technology!!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cybrosys Technologies

Cybrosys Technologies

We are Odoo Gold Partners standing par excellence in Odoo implementation, customization and allied services.

More from Medium

Apagen’s Odoo Implementation Services

Enable Custom Domain to AWS API Gateway with Free SSL

Github Branch Management