Odoo Help


Limit the number of digits in integer?

Wolfgang Pelser
on 7/2/14, 3:32 AM 8,105 views

Is there a way to limit number of digits in integer in OpenERP like you can in char type? I need field that would only let you enter max two digits.

For example with char, you can do this:

'char_field': fields.char(size=2),

Then if you try to enter more than two symbols, it won't write it.

But if I create integer field:

'integer_field': fields.integer(),

It will let me write any number of digits I want.

Thanks Atul It's an easy solution..

Wolfgang Pelser
on 7/2/14, 3:36 AM
Atul Arvind
On 7/2/14, 3:33 AM

You can use a _constraint to check the value of your integer and raise an exception if it is not in your desired range.

Check this blog post about how to create a constraint.

René Schuster
On 7/2/14, 3:40 AM

The size attribute is also availbe for integer fields!

'integer_field': fields.integer('My Integer', size=4),



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/2/14, 3:32 AM
Seen: 8105 times
Last updated: 7/27/17, 2:58 AM