Odoo Help


How to use Html attributes with Odoo form fields

Nikhil Mohan
on 7/28/16, 5:01 AM 350 views

I'm trying to use HTML attributes with form fields. What I was trying is to use maxlength attribute with a text field. I tried the followings:

1. <field name="slug" maxlength="50" />
2. <field name="slug" attrs="{'maxlength': '50'}" />

But neither of these tactics are not working. Is it possible to use native HTML attributes like maxlength, size etc with Odoo form fields?

Any help would be appreciable!!


Francesco OpenCode

--Francesco OpenCode--
Francesco OpenCode
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 7/28/16, 5:53 AM

Fields of type text have a size parameters that can be used in definiton

slug = fields.Char(size=50)

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: 7/28/16, 5:01 AM
Seen: 350 times
Last updated: 7/28/16, 5:53 AM