Odoo Help


how to set field attr by on_change function?

Voathnak Lim
on 9/25/13, 11:18 PM 1,806 views

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


Andreas Brueckl

--Andreas Brueckl--

| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 9/26/13, 5:02 AM

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...?

Voathnak Lim
on 9/27/13, 1:18 AM

Nice suggestion :)

Darius Martinkus
on 5/28/15, 8:23 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/25/13, 11:18 PM
Seen: 1806 times
Last updated: 3/16/15, 8:10 AM