Odoo Help


This community 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.


Controling \t in odoo v8

Drees Far
on 7/13/15, 7:48 AM 374 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

--Atul Arvind--
| 3 3 5
--Atul Arvind--


I am odoo Enthusiast/Consultant from Baroda, Gujarat, India. Working with odoo from v5 to v9 and other opensource technology since 4+ years. Having Strong Expertise in

Requirement gathering & Gap Analysis

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration


I am also active on StackOverflow.


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)

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 7/13/15, 7:48 AM
Seen: 374 times
Last updated: 7/28/15, 9:45 AM