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

I have been able to see that in version 17 there is a problem with the invisibility of the fields. Since the fields do not become invisible but rather remain readonly. Has anyone had this happen to you?


                                                                                                                                                                 




อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Dear Kiran,

I have changed the code but it's not working, the result is the same

@api.model
def _get_view(self, view_id=None, view_type='form', **options):
arch, view = super()._get_view(view_id, view_type, **options)
if view_type == 'form':
parameters = self.env['ir.config_parameter'].sudo()
name_var1 = parameters.get_param('act1.var1')
if (name_var1 != False):
for node in arch.xpath(
"//field[@name='var1']"
):
node.attrib['string'] = name_var1
else:
for node in arch.xpath(
"//field[@name='var1']"
):
node.attrib['invisible'] = '1'
return arch, view

Kind regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

If you work in a tree view you have to use "column_invisible="True""

ex:

Hope your issue is sorted out.

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Roger,

Please share the code also,

Did you try with 'column_invisible'

eg:




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

This is the correct property, thanks very much Kiran.
The finally code is :
@api.model
def _get_view(self, view_id=None, view_type='form', **options):
arch, view = super()._get_view(view_id, view_type, **options)
for node in arch.xpath(
"//field[@name='field_column']"
):

คำตอบที่ดีที่สุด
On Odoo 17, to hide a field on the list view, define the attribute column_invisible="1"

Note that the "invisible" attribute does not work on the list view but on the form view it still works

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

In odoo 17 if you need to make a field invisible, use the invisible attribute in the XML file. Try with the below line of code.

<field name="your_field_name" invisible ="1"/>


Hope it helps

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

Dear Cybrosys,

The problem is the same. If i change the property, the field is change to read only but it don't change to invisible.

Kind regards.

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 23
3584
1
ก.ค. 24
1562
1
มี.ค. 24
1638
v17: error while inheriting res.users แก้ไขแล้ว
3
ม.ค. 24
2726
3
ส.ค. 22
11954