Hello everybody, In many2one field, when I put some caracters the autocomplete return all strings contains these caracters. For example if I put "ma" the autocomplete return ("image","manager","roma" ...). What I want is that the autocomplete must return exactly the sting which start with for example "ma" not witch contains "ma" in everywhere (at first, middle or last). So where and which file I must modify. Thank you.
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ờ
I suggest you to override the name_search() method of your object like that:
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
if context is None:
context = {}
ids = []
name = name + '%'
cr.execute("SELECT id FROM your_object_table WHERE name like %s", (name,))
ids = cr.dictfetchall()
return self.name_get(cr, uid, ids, context)
let me know if it works
Thank you very much brother :) it works perfectly ;) thanks again.
hey should we create another table for that field?
hey should we create another table/class for that field? I need it for particular object
hey should we create another table/class for that field? I need it for particular object
I need it for a particular object.
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ý
Do you need this feature for all many2one fields or only for a particular object ?
I need it for a particular object.