Odoo Help


how to set field attr by on_change function?

voathnak lim
on 9/25/13, 11:18 PM 1,378 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--
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 :)

on 5/28/15, 8:23 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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: 1378 times
Last updated: 3/16/15, 8:10 AM