问题
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?
回答1:
Found it already, need to use editable="false":
<tree create="false" delete="false" editable="false">
</tree>
回答2:
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 :)
回答3:
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>
来源:https://stackoverflow.com/questions/31611065/odoo-make-it-impossible-to-edit-a-record-in-tree-view