Remove Link From Many2One Fields In Odoo

Odoo is a suite of web browser based open source business applications. It is an open source ERP Software. The main Odoo Modules include an Open Source Customer Relationship Management, Website Builder, eCommerce, Restaurants Management(Point Of Sale),Project Management,Billing & Accounting,Human Resources, Marketing, Manufacturing, Purchase Management, and so on.

We can customize module from scratch and use this application for different sectors of Industry like online school management system, online Travel management system etc. Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Applications.

Odoo supports several views ,ORM methods,fields etc. Views like Tree,List,Graph,Form,Calendar,Kanban etc. In form view’s read only mode, many2one fields are shown by default as links pointing to the referenced objects. Most of the times this is undesirable, especially when accessing simple models.

For ex: Lets assume there is Sale Order form in which Customer Name(partner_id) is listed as Many2One of res.partner(referenced object). Once we save this form i.e Read mode,partner_id field becomes a link to the reference object i.e. res.partner. So user can have access to Customer(res.partner) class which is undesirable. Similarly in Edit mode,it also gives access to the referenced object by an arrow.

So how to restrict this access in Odoo? Answer is simple and that is to make use of widgets. User can alter this behavior and simply show referenced object’s name, without linking to it, using widget option called no_open: as follows.

<field name=”partner_id” options=”{‘no_open’: True}”/>
As a result of it, the link is removed and User does not have access to referenced object i.e res.partner in Read or Edit mode of the form view. User can apply this widget to as many Many2One fields.


                          In Read Mode                                  In Edit Mode


Leave a Reply