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

How would you change the attributes of an existing field?

I have set up a form view that inherits base.view_partner_form

I want to hide the 'is_company' field. I still need it to have a value, so can't just use position=replace to remove it. I tried adding in <field name="is_company" invisible="1"/> but unsurprisingly it didn't work. how are you meant to do this?

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

The correct code is:

<field name="is_company" position="replace">
    <field name="is_company" invisible="1"/>
</field>

I want to remind you that field attributes can also be changed like this:

<field name="is_company"  position="attributes">
    <attribute name="invisible">True</attribute>
</field>
อวตาร
ละทิ้ง
ผู้เขียน

Thanks, I tried it the first way and the field label is still showing up (with parentheses before and after the field) can this be hidden too?

the label should be able to hide as any field: <label string="Blablabla" position="replace" />

ผู้เขียน

Thanks again. You can probably tell I haven't quite got my head around it yet. On the form view "is_company" is in itself part of a label for the "name" field. I guess this is why parentheses are showing up. I think I can figure it out from here.

คำตอบที่ดีที่สุด

do both, have the position replace and replace it with invisible=1

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Change position chatter แก้ไขแล้ว
1
ส.ค. 25
166
4
ก.ค. 25
1507
1
ก.ค. 25
825
2
ก.ค. 25
854
1
ก.ค. 25
1965