Odoo Studio: adding a one2many field

See also: Adding relational fields using Odoo Studio

Because it’s a list, the most convenient place to put this is in a new tab. It’s easy to create one.

Now drag the ‘one2many’ button to the tab that you just created.

Odoo will display a list of the existing database relationships for the model (table).

If you see the field and associated Model you want, select it:

(or you can click on “Search More” to see a full list of related fields and linked models)

You will see “NewOne2many” field both on the right-hand side and left-hand side:

The first things to do are:

  • Give the field a meaningful name
  • Make it read-only:

Next we need to “clean up” the List View. We do that by clicking on “Edit List View”

For example, maybe we don’t need to see the Delivered Quantity, so let’s remove it. Click on the column and then “Remove from View”

We can also rename the tab from ‘New Page’ to something more meaningful. Click on the tab and then change the Label.

Here’s the tab (with a few more columns removed)

What could we do next?

  • Only show confirmed orders
  • Show the order status
  • Add other information

Form View

There is also a Form View for every Sales Order line and we can modify this using Studio.

Click on “Edit Form View”

Now you customize this in the same way as any other Form View

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s