Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Aprovações
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Administração de propriedades
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setores
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Conheça um consultor
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Financeiro
  • Inventário
  • PoS
  • Projeto
  • MRP
All apps
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

How to search for several words in products name from sales order?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
v7search
8 Respostas
17190 Visualizações
Avatar
Kitti Upariphutthiphong

Hello,

Is it possible to implement a very flexible (almost like fulltext) search for, i.e., Products in Lines.

The intention of this is for the user to as quickly as possible find the product (during new lines and not using the search view), which they might not even know the exact name, not even order of it, they just know part of the keywords.

For example, given the product name like, "Panel / White Color / 50x40".

I am looking for the way to enhance the product fields (in Order Line), so user can just type "50x40 white" to match the item. It is almost like google search to me.

Many thanks, Kitti U.

4
Avatar
Cancelar
Sehrish

You can do it dynamically see this: https://apps.odoo.com/apps/modules/17.0/mh_dynamic_name_search

Avatar
Andreas Brueckl
Melhor resposta

I think that you are looking for the name_search function. This function is used for the search in many2one fields. This is for example the Product in the Order Line. You can override this function to fulfill you requirements.

As an example look at the name_search function of the Product (product.product).

def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
    if not args:
        args = []
    if name:
        ids = self.search(cr, user, [('default_code','=',name)]+ args, limit=limit, context=context)
        if not ids:
            ids = self.search(cr, user, [('ean13','=',name)]+ args, limit=limit, context=context)
        if not ids:
            # Do not merge the 2 next lines into one single search, SQL search performance would be abysmal
            # on a database with thousands of matching products, due to the huge merge+unique needed for the
            # OR operator (and given the fact that the 'name' lookup results come from the ir.translation table
            # Performing a quick memory merge of ids in Python will give much better performance
            ids = set()
            ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context))
            if not limit or len(ids) < limit:
                # we may underrun the limit because of dupes in the results, that's fine
                ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit and (limit-len(ids)) or False) , context=context))
            ids = list(ids)
        if not ids:
            ptrn = re.compile('(\[(.*?)\])')
            res = ptrn.search(name)
            if res:
                ids = self.search(cr, user, [('default_code','=', res.group(2))] + args, limit=limit, context=context)
    else:
        ids = self.search(cr, user, args, limit=limit, context=context)
    result = self.name_get(cr, user, ids, context=context)
    return result
2
Avatar
Cancelar
Kitti Upariphutthiphong
Autor

Hello Andreas. Yes I think this is what I am looking for. Thank you so much!

Joie Hadinata

Where do i put this in odoo online version 16 ?

GRENET Thomas

+1 for Odoo Online. Is there a way to put this code in Odoo Online ?

Avatar
Fabien Pinckaers (fp)
Melhor resposta

By default, in the search view, if you do 2 searches on the same field (e.g. "Panel" & "White"), OpenERP will apply a OR condition between both. This would result into: Product contain Panel OR product contain "White". So, this will not work for your example.

To do a AND between two criteria of the same field, you can use the advanced search.

For your example, if you are in the Sales Orders or Quotations, you can do this through applying two advanced searches:

Order Lines contains Panel
Order Lines contains White

Do not add conditions within the same advanced search, you must apply two searches.

Note that it will match Panel and White, regardless of the order.

2
Avatar
Cancelar
Avatar
filsystem
Melhor resposta

In search field name from product list (tree) or in field product_id from order line (form) you can use regular sql LIKE expression with wildcard: 'Panel%White%50x40'. You will receive all product with 'Panel' or 'White' or '50x40' in name.

1
Avatar
Cancelar
Mahmoud Korayem

What if I need it to search in other fields than the name ?

Michael C

This is BRILLIANT. Thank you.

Avatar
Kitti Upariphutthiphong
Autor Melhor resposta

Thanks Fabian for the quick answer. But i think it is not exactly what I am looking for.

The intention of the question is for the user to as quickly as possible find the product (during new lines and not using the search view), which they might not even know the exact name, not even order of it, they just know part of the keywords.

Says, there are huge amount of products. And what they want to find is the one named, "Panel - White Color - 40x40".

I am looking for the way to enhance the product fields (in Order Line), so user can just type "40x40 white" to match the item. It is almost like google search to me.

Sorry if my question is not clear. But this is something many customer wanted (especially, organization with a lot of products)

Thank you, Kitti

0
Avatar
Cancelar
Fabien Pinckaers (fp)

please edit your question for clarification instead of adding an answer

Asha

how did you solved this? I am also having same requirement in odoo14 and searching for a solution

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscreva-se
Publicações relacionadas Respostas Visualizações Atividade
Once installed, how do you use addon web_filter_and_condition?
v7 search
Avatar
Avatar
1
mar. 15
4528
How to allow the use of the child_of operator for users ?
v7 search
Avatar
0
mar. 15
9240
How can I locate the certain SO/PO with the product code/desc?
v7 search
Avatar
Avatar
Avatar
2
mar. 15
6500
How can I change the search for products to treat a space like Google does?
product v7 search
Avatar
0
dez. 23
5617
How to add a scrollbar in product search?
javascript v7 search
Avatar
1
mar. 17
5024
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now