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

I want to access database and get the name from a table to check if the name exist or not.

I know that I need to override the create function but I have no idea for what should I put inside the function

Also, i'd like to ask how to pop up en error message like the validate checking when the name is existed

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

you can use cursor(or cr) present in a method..

almost all ORM methods will have these paramaters: self, cr, uid

so one can use cr, which is nothing but cursor paramater used to deal with database...

Example: cr.execute("select * from res_partner")

And to do validation: you can set _sql_constraints in your object
 

Hint: use Ctrl + H to search in you the addons, if you are using EDI like eclipse/aptana studio

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 4 24
1992
3
thg 5 22
15575
1
thg 12 16
3261
1
thg 3 15
12233
0
thg 3 15
3433