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

Hello does anyone have any idea or doc about return the attr like : invisible or required from on_change function?

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

You can do it the following (indirect) way:

  • Use a hidden boolean field flag
  • For the field you want to set required or invisible use attrs="{'invisible': [('flag','=',True)]}"
  • In the on_change function you can now return the value for flag
อวตาร
ละทิ้ง
ผู้เขียน

Thank you Andre, but the field flag gonna save in database right?, and could we have another solution like return context or domain...?

Nice suggestion :)