Odoo Help

Welcome!

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.

0

Raisin exception when a field contain only one or many spaces in odoo v8

By
Drees Far
on 7/13/15, 8:59 AM 339 views

Hello!!

Please, i have a field that i dont want to be an empty string.

I tried those choices:

1/ if ' ' in project:

My_error_Msg2 =  'Please your project can not be empty' raise osv.except_osv(_("Error!"), _(My_error_Msg2))

----> when the field contain two string separated by a space it raises an exception

2/ if  project == ' ':

My_error_Msg2 =  'Please your project can not be empty' raise osv.except_osv(_("Error!"), _(My_error_Msg2))

----> it doesnt raise an exception

Please help

0
Dairidi
On 7/13/15, 9:47 AM

In case two you entered only a whitespace? or left the field empty?

The first case should also cover the case that there is only a single space in the string.

But I don't see why the second case is not working

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)

Stats

Asked: 7/13/15, 8:59 AM
Seen: 339 times
Last updated: 7/28/15, 9:45 AM