Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
8 Trả lời
29601 Lượt xem

Hi,

i want to remove the "editable" attribute from a tree view

<tree string="Phone Calls" editable="top" >

is the original view, i dont want to edit them, to stay update save.

I need somethink link:

<tree string="Phone Calls" editable="none" >

But this did not work. I get a error for not valid xml. Have someone a simular problem and a solution?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

To remove editable in tree view you must use only tree string like below :

<tree string="Phone Calls" >

if you want to remove via inherit then try below exmple:

        <record id="view_form_editable_list" model="ir.ui.view">
        <field name="name">objectt.form.editable.list</field>
        <field name="model">object.object</field>
        <field name="inherit_id" ref="view_ref"/>
        <field name="groups_id" eval="[(6, 0, [ref('groups_if_any_in_tree_view'),ref('groups_if_any_in_tree_view'),])]"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='one2manyr_line']/tree" position="attributes">
                <attribute name="editable"/>
            </xpath>
        </field>
    </record

In groups_id you can add that groups which are in tree views fields so when this all applied group is active then editable is removed from tree view.

Ảnh đại diện
Huỷ bỏ
Tác giả

I know, but then i have to edit the original tree view, if i add this by a inherited view it will not work. Update the original view is not 'update save' and should be avoid

Tác giả Câu trả lời hay nhất

Correct solution is:

<?xml version="1.0"?>
<data>
<xpath expr="//tree" position="attributes">
                <attribute name="editable" />
            </xpath>
</data>
Ảnh đại diện
Huỷ bỏ

Your solution works perfectly for me. Many thanks!

Câu trả lời hay nhất

i have had a little bit different problem, remove the editable from a tree view. but i hope this helps somebody who are facing the same problem.

to remove editable from an existing tree view, like from Attendance List in Odoo 13 like this

<?xml version="1.0"?>
<tree string="Employee attendances" editable="bottom">
                <field name="employee_id"/>
                <field name="check_in"/>
                <field name="check_out"/>
                <field name="worked_hours" string="Work Hours" widget="float_time"/>
            </tree>

use this code

<xpath expr="/tree" position="attributes">
                <attribute name="editable"/>
            </xpath>
with one slash in front of "tree"

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I have the same issue and I am looking for a solution. If you have found anything please let me know. for the others what I want to do is to be able to open form in treeview witch have editable="bottom/top". I think it's a bug in V8 because this still possible in V6.1.

Regards.

Ảnh đại diện
Huỷ bỏ

answer from Torsten Francke should solve your problem

Câu trả lời hay nhất

As I have had the opposite problem - make an existing view editable by an inheritance - many thanks to Thorsten Francke! Your answer gave me the hint after hours of searching ... So maybe this helps somebody one day ...

In the inherited view do:

<xpath expr="//tree" position="attributes">
    <attribute name="editable">top</attribute>
 </xpath>

Regards

Ảnh đại diện
Huỷ bỏ