Hello,
On sales order, I would like to select a partner from the select box by start typing its phone number.
How can I do that?
Thank you in advance!
Regards
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
On sales order, I would like to select a partner from the select box by start typing its phone number.
How can I do that?
Thank you in advance!
Regards
_name_search method will allow to customize the search based on other field.
to search based on phone filed you need to override the method of res_partner like
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if not context: context={}
res = super(res_partner, self). name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit)
if name:
ids = self.search(cr, user, [('phone','=',name)]+ args, limit=limit, context=context)
if ids:
res = self.name_get(cr, user, ids, context=context)
return res
it will give you partner when you search related partner phone.
@Atul, it is more performant if you just add the args before calling the super. Then, it will only search once. Also, I think you shouldn't return the return of name_get.
You need to enhance the name_search method of res.partner to also search the phone number field. You may want to enhance the name_get method as well to display the phone number field.
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-sePublicações relacionadas | Respostas | Visualizações | Atividade | |
---|---|---|---|---|
|
4
nov. 20
|
6274 | ||
Get values from python method - Odoo 8
Resolvido
|
|
1
mar. 15
|
4981 | |
|
1
jun. 23
|
2269 | ||
Autocomplete input on frontend
Resolvido
|
|
1
out. 22
|
4822 | |
|
2
dez. 20
|
6232 |