How To Add One2many Field In Odoo

In this article, we will discuss how to add a one2many field in Odoo. A one2many field is a type of relationship that allows you to create a list of records related to another record. This can be useful for organizing data and creating custom views.

Step 1: Create the Model

The first step in adding a one2many field is to create the model that will contain the field. To do this, go to the Odoo backend and navigate to Settings > Technical > Models. Click on the Create button to create a new model.

Step 2: Add the One2Many Field

Once you have created the model, you can add the one2many field. To do this, go to the Fields tab and click on the Add a field button. Select One2Many as the field type and enter the name of the related model in the Relation field.

Step 3: Save and Test

After adding the one2many field, save the changes to the model. You can then test the new field by creating a record in the related model and selecting it from the list in the one2many field.

Conclusion

Adding a one2many field in Odoo is a simple process that can be done in just a few steps. By following these steps, you can create custom views and organize your data more efficiently.