Odoo Help

Welcome!

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.

0

return attrs from python code

By
Gustavo
on 1/8/15, 4:30 PM 979 views

I would hide fields dynamically from python, required them, or read-only; from python I've seen that can return a 'domain' for a field, is it possible this same way also return 'attrs'?

example: 

                res.setdefault('domain', {})
                res['domain']['sale_tax'] = repr(sale_tax_domain)
                res['domain']['purchase_tax'] = repr(purchase_tax_domain)

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 1/8/15, 11:38 PM

attrs can be set using domain.  You can set the domain to use turn readonly, required, and invisible of the attrs based on the value of a field (or combination of those).  Or, if you really need, create a function field of boolean type to calculate the readonly, required, and invisible, then use that in the attrs domain.

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)

Stats

Asked: 1/8/15, 4:30 PM
Seen: 979 times
Last updated: 3/16/15, 8:10 AM