Odoo Help


This community 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.


how to set field attr by on_change function?

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

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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