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

Filter a one2many field with a search view

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
filterone2manysearch_view
1 Responder
24177 Visualizações
Avatar
Jean-Claude Rieth

In a form view of a project.project model, I display related calendar.event records through a one2many field as a kanban

I'd like to filter that kanban view, but it doesn't work as described below.


On the form, I added the following field:

<field name="event_ids" mode="kanban"/>

The kanban shows up nicely on the form. Actually, a kanban view has been applied by default: the one that has the lowest sequence id.


As the system selected a kanban view, I assumed a search view is also applied by default.

The search view with the lowest sequence id is the following:

<record model="ir.ui.view" id="view_calendar_event_mysearch">

     <field name="name">calendar.event.mysearch</field>

     <field name="model">calendar.event</field>

     <field name="arch" type="xml">

        <search string="My search view">

            <field name="allday"/>

            <filter string="Full day events" name="filter_on_fullday" domain="[('allday','=',True)]"/>

         </search>

     </field>

</record>


If the search view would have been called from an action, I could have indicated a default filter in the act_window, like:

<field name="context">{'search_default_filter_on_fullday': 1}</field>


which made me think I could define a context on the field, like:

<field name="event_ids" mode="kanban" context="{'search_default_filter_on_fullday': 1}"/>


I must be missing something in my reasoning, because it doesn't work.

Maybe, no search view is selected by default. Can someone confirm?

How can I force a search view? And once a search view is applied, would it use the default filter?

If there is a search view, how can I tell the search view to execute the filter?

Thank you for your help.

1
Avatar
Cancelar
Niyas Raphy (Walnut Software Solutions)

https://www.odoo.com/forum/help-1/question/how-to-search-po-by-product-name-search-on-one2many-fields-31030

Avatar
Jean-Claude Rieth
Autor Melhor resposta

Here is the solution.

In order to filter a one2many field on a form, the trick is to make a computed field, from the initial one2many field.

In my case, event_ids is the field I want to filter, in order to show only full day events.

In the model, I simply added a computed field, as follows:

    event_fullday_ids = fields.One2many('calendar.event', string='Full day events', compute='_get_event_fullday_ids')

And the function is:

    def _get_event_fullday_ids(self):
        self.event_fullday_ids = self.event_ids.search([('allday', '=', True)])

Then, instead of showing

<field name="event_ids" mode="kanban"/> on the form

I put this instead:

<field name="event_fullday_ids" mode="kanban"/>


3
Avatar
Cancelar
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
All the items should be populated from drop down list and should be able to add/remove single, multiple or all the items as tags
filter search_view
Avatar
0
dez. 15
3638
How can I add a search filter option for a one2many field on a form view in odoo9?
filter one2many search form_view search_view
Avatar
Avatar
1
jul. 19
11235
Filter One2many field in res.partner Resolvido
filter one2many odoo16features
Avatar
Avatar
1
jan. 24
2544
Filter one2many with dynamic values
filter one2many filters
Avatar
0
jun. 21
3275
Filter displayed data in one2many field
filter form one2many
Avatar
Avatar
Avatar
3
set. 17
7840
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