Odoo Help


Controling \t in odoo v8

Drees Far
on 7/13/15, 7:48 AM 684 views


I want to controle a field if it contains a space (\t) in odoo v8.

Pleas, how can i do it help

Elaborate your purpose little bit please !

Emipro Technologies Pvt. Ltd.
on 7/13/15, 8:38 AM

I have a field called project in which i wouldnt have empty string so i put it required= True and now i want it to NOT COTAIN a space.

Drees Far
on 7/13/15, 8:44 AM
David Bertha
On 7/13/15, 8:57 AM

You should define a python constraint

_constraints = [(_function_name, warning_string, list_of_relevant_attributes)]
ex :

_constraints = [(_check_empty_string, 'The name cannot contains only spaces", ['name'])
def _check_empty_string(self, cr, uid, ids, context=None) : (old API way)
    project = self.browse(cr,uid, ids, context=context)
    return not project.name.isspace()
Atul Arvind
On 7/13/15, 9:29 AM

for v8 you can write constraint like to validate the space,

def check_name(self):
if self.name.isspace():
raise ValidationError("Name can not be Empty")

name = fields.Char('Name', required=True)

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/13/15, 7:48 AM
Seen: 684 times
Last updated: 7/28/15, 9:45 AM