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

I added two field in the wizard column, like this :


in .py

division = fields.Selection([('Unit','Unit'),('Sparepart','Sparepart'),('Umum','Umum')], 'Division')

chassis_number = fields.Char('Chassis Number')


in .xml

<field name="division"/>

<field name="chassis_number" attrs="{'invisible': [('division','!=','Unit')]}"/>


I need to hide chassis_number field when division is not Unit. And I tried the code like above, but it doesn't work. The effect so as read only. Is there anyone have solution?

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

Try following:

  • 1./ <field name="chassis_number" attrs="{'invisible': [('division','not in',['Unit'])]}"/> 

OR

  • 2./ <field name="chassis_number" attrs="{'invisible': [('division','in',['Sparepart','Umum'])]}"/>

Hope this helps !!.

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

Hi Emipro.. I have tried it, but same as before. Are you have other solution?

Check whether you didn't put same field twice on the view. i.e "Division"

Tác giả

I have check and there is only one field on the view

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 25
52
0
thg 8 25
7
0
thg 2 25
728
2
thg 10 24
3621
2
thg 6 24
2118