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.
BEFORE
In Read Mode In Edit Mode
AFTER
Your answer
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
Keep Informed
About This Forum
This forum is for HiTechnologia Employees & just Odoo general knowledge purpose only.
Read GuidelinesQuestion tools
Stats
Asked: 8/15/15, 7:00 AM |
Seen: 5186 times |
Last updated: 8/15/15, 7:01 AM |