I would like to know, how to create SQL indexes on the custom module using Python/ORM methods....
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
If you want to create complex indexes, you need to inherit _auto_init method of the model and execute a CREATE INDEX (using cr.execute) statement after you call the super.
If you just want to create per column index - PostgreSQL is capable to combine index, just add select=1 in the column definition, like so:
'name' ; fields.char('Name', size=64, select=1)
If you are interested on how a table and it's related objects, read the _auto_init method of BaseModel.
Thanks Ivan , Yes I too found the same by referring "account_move_line" object... However I came over across 2 kinds of select parameters, i.e "select=1" means Basic Search, "select="2" means Advance Search... Any idea what exactly is the difference... In database level I see no difference between these two indexes..
I think that has something to do with whether the field will be displayed as search criteria by default in a search view. If select=1, a default search view will have the field added. At least that is what I've experienced with v6. I'm not sure whether it is still valid for v7 and v8.
Ya ok, even I feel the same.. thanks anyway :)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 6 25
|
1931 | ||
|
1
thg 3 25
|
5174 | ||
|
3
thg 3 15
|
7075 | ||
|
1
thg 6 23
|
9098 | ||
|
0
thg 4 16
|
4195 |