Odoo Help


How to use Html attributes with Odoo form fields

Nikhil Mohan
on 7/28/16, 5:01 AM 1,159 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--

| 6 8 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)

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