Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2363 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 25
1262
0
thg 1 25
3305
1
thg 8 23
14609
change password Đã xử lý
1
thg 8 23
13254
1
thg 7 23
10271