How to give limit for entering values in Integer, Numeric

How can I give the limit for Integer field rather than giving validations for the same.
For example in case of Char field we give “size”. shown below is the example for Char field my_field_name = fields.Char(‘my_string’, size=10)
How can I do the same for Integer, Numeric field.
Any help regarding the same will be helpful!!!

You can set a domain on the field using the field name as field name.
Eg:

value = fields.Float("Value", domain=[('value', '>=', 0), ('value', '<', 100)])

@ced The above code worked thanks for the same!!!
But on saving the record there comes an issue which is that this field after not being given “required” too it needs to be filled or else the record remains unsaved.

Indeed if you want to allow None value, you must make the domain allow it like:

['OR', ('value', '=', None), [('value', '>=', 0), ('value', '<', 100)]]
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.