Hello odoo community,
I was wondering if its possible to make many2one field and when you type in something it would search by multiple criteria like (name, phone number, etc)?
Any example and help would be appreciated
Thank you
DM
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello odoo community,
I was wondering if its possible to make many2one field and when you type in something it would search by multiple criteria like (name, phone number, etc)?
Any example and help would be appreciated
Thank you
DM
Hello Darius,
try like below example.
@api.model
def name_search(self, name, args=None, operator='ilike', limit=100):
partners = self.search(['|', '|', ('name', operator, name), ('phone', operator, name), ('email', operator, name)]) # here you need to pass the args as per your requirement.
return partners.name_get()
By using name_search() Definition we can do it.
You can get an idea by seeing following sample code.
def name_search(self, name, args=None, operator='ilike', limit=100):
recs = self.search(['|','|',('name', operator, name),('phone', operator, name),('mobile', operator, name)] + args, limit=limit)
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
2
mar 24
|
1659 | ||
|
1
apr 16
|
3235 | ||
|
3
ott 15
|
11734 | ||
|
0
mar 15
|
3617 | ||
|
3
feb 25
|
35404 |