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

I have a many2many field of which I want a a column to be invisible given a conditional attribute. I can make the field invisible, but this only causes the cell to be grey and doesn't remove the column. When I use the column_invisible attribute I get the following error:

"The requested change caused an error in the view. It could be because a field was deleted, but still used somewhere else."

Not sure how that error applies here. Using v12.

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

can you share more detail in images ?

Tác giả

Sorry, posted my comment as an answer instead of a comment - not enough Karma to convert.

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

attrs column_invisible can only work with parent please try to make it as:


  attrs="{"column_invisible": [["parent.project_id","=",2]]}"


hope this will help 

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất
<xpath expr="//form[1]/sheet[1]/group[1]" position="after">
<field name="task_order_line">
<tree string="Task Order Line" editable="bottom">
<field name="expected_date" attrs="{"column_invisible": [["project_id","=",2]]}"/>
<field name="project_id" invisible="1"/>
</tree>

The above code is what is causing the error. When I change "column_invisible" to "invisible", it works but greys out the many2many box instead of making the column disappear. I have other fields in my tree view, but for brevity in this post I've removed them.

For some reason the forum is not allowing me to upload pictures, not sure why.

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

Hi, try with this:

<field name="expected_date" attrs="{"column_invisible": [('project_id',"=",2)]}"/>

Tác giả

Same error.

Can you please share the screenshot of error too?

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 5 23
5
0
thg 11 22
2457
2
thg 4 21
12641
1
thg 5 23
3720
4
thg 10 21
80169