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

I would like to remove the editable attribute from this view element <tree string="Sales Order Lines" editable="bottom"> in my custom module.

I do not want to replace the whole tree element for the sake of removing the attribute.

How can I remove the editable attribute from the element above?



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

please try this
<record id="view_order_line_form_editable_list" model="ir.ui.view">
<field name="name">sale.order.line.form.editable.list</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree" position="attributes">
<attribute name="editable"/>
</xpath>
</field>
</record>

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

@Ahmed Ababneh

You could do it like this:

<xpath expr="//form/field[@name='order_line']/tree" position="attributes">
    <attribute name="editable">top</attribute>
</xpath>


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

You can override fields_view_get method for that object. Get the 'arch' by calling super method and remove the "editable" attrs from tree view. You will have to use python lxml packages and use etree to convert the arch into xml. You will get lots of examples in odoo addons of overriding fields_view_get.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 22
13
2
thg 6 25
533
1
thg 3 25
1178
0
thg 11 24
1420
2
thg 9 24
4379