跳至内容
菜单
此问题已终结
2 回复
2378 查看

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

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
0
3月 25
1264
0
1月 25
3310
1
8月 23
14623
1
8月 23
13260
1
7月 23
10282