Reputation: 757
In Odoo you can make it impossible to create or delete records from the tree view like this:
<tree create="false" delete="false">
<field name="create_date" readonly="True"/>
</tree>
But I can still click the records and go to the form of that record. Is there a way to make it impossible to click those records and edit them?
Upvotes: 3
Views: 15557
Reputation: 116
A solution for the complete tree view (action) to be read-only is to not provide form
in the view_mode
attribute in addition to the create
, edit
(and delete
) options:
<record id="hr_timesheet_line_tree" model="ir.ui.view">
<field name="name">hr.analytic.timesheet.tree</field>
<field name="model">hr.analytic.timesheet</field>
<field name="arch" type="xml">
<tree string="Timesheet Activities" create="false" edit="false" delete="false">
<field name="date" on_change="on_change_date(date)"/>
<field name="name"/>
</tree>
</field>
</record>
<record id="act_hr_timesheet_line_evry1_all_form" model="ir.actions.act_window">
<field name="name">Timesheet Activities</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.analytic.timesheet</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to record activities.
</p>
</field>
</record>
Upvotes: 1
Reputation: 757
Found it already, need to use editable="false"
:
<tree create="false" delete="false" editable="false">
</tree>
Upvotes: 6
Reputation: 2892
Hear it is possible to editable of your tree view to change the attribute of Tree tag
just do some things like this
Editable on Bottom :
<tree create="false" delete="false" editable="bottom">
</tree>
Editable on Top :
<tree create="false" delete="false" editable="top">
</tree>
I hope my answer may helpful for you :)
Upvotes: 5