Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
18274 มุมมอง

I tried using xpath on an inherited tree view but it doesn't change the default value of the attribute optional.

<xpath expr="//field[@name='existing_field']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>

✅ EDIT: It now works by replacing the field and setting the optional attribute to 'hide'.

<xpath expr="//field[@name='existing_field']" position="replace">
<field name="existing_field" optional="hide"/>
</xpath>
อวตาร
ละทิ้ง
ผู้เขียน

✅ It now works by replacing the field and setting the optional attribute to 'hide'.

<xpath expr="//field[@name='existing_field']" position="replace">

<field name="existing_field" optional="hide"/>

</xpath>

ผู้เขียน คำตอบที่ดีที่สุด

✅ It now works by replacing the field and setting the optional attribute to 'hide'.

<xpath expr="//field[@name='existing_field']" position="replace">
<field name="existing_field" optional="hide"/>
</xpath>
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

That's how you do it, check your xpath and View sequences.

Excerpt from the Odoo v14 native View sale.order.tree:




อวตาร
ละทิ้ง
ผู้เขียน

Hello, Ray! Thank you for taking the time to respond to this. What I was aiming to do is override the attributes of existing fields in a tree view. The field I want to change already has an attribute optional that is set to "show" but I want to "hide" it without replacing the field. Is it possible just to override the attribute?

Yes it is possible and you are doing it the right way. Check all views and their sequences to find the problem.

ผู้เขียน

If I replace the field with nothing, the field disappears. However, if I only change the attribute, it still shows in the view. Should I put this?

<field name="priority" eval="100"/>

try to replace field and add the new field with attribute.

ผู้เขียน

Hello, Hilar! I tried doing what you said and it works after installing the module! Before I tried it, I only override the attribute and not the field itself then installed the module which didn't work. Then, I tried replacing the field itself with the optional attribute set to 'hide' and it now works! Thank you!

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
เม.ย. 25
4665
5
พ.ย. 23
42969
Create dynamic tree view แก้ไขแล้ว
3
ก.ย. 23
9461
1
ก.ย. 22
3731
1
มิ.ย. 22
12554