Hi!!
I want to controle a field if it contains a space (\t) in odoo v8.
Pleas, how can i do it help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi!!
I want to controle a field if it contains a space (\t) in odoo v8.
Pleas, how can i do it help
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()
for v8 you can write constraint like to validate the space,
@api.constrains('name')
def check_name(self):
if self.name.isspace():
raise ValidationError("Name can not be Empty")
name = fields.Char('Name', required=True)
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-seRelated Posts | Respostes | Vistes | Activitat | |
---|---|---|---|---|
|
0
de març 25
|
1264 | ||
|
0
de gen. 25
|
3310 | ||
|
1
d’ag. 23
|
14623 | ||
change password
Solved
|
|
1
d’ag. 23
|
13260 | |
|
1
de jul. 23
|
10282 |
Elaborate your purpose little bit please !
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.