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

[✅ SOLVED] How to extend a XML search filter view and add an additional filter ?

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
filtersearchviewxmlviewv18
1 Responder
3316 Visualizações
Avatar
AdaLabs Ltd

Hi,

our aim is to extend a XML search filter view and add an additional filter.


This is the very first step we want to achieve. Then we will enhance our search filter domain by using a computed, searchable and not stored field. Finally, we will make the filter to be a default filter for users of a specific group. This bigger picture context is the reason why we want to achieve our aim this particular way.


Our Odoo module technical name is called al_hr_holidays, and inherits from the Time Off Odoo app, which technical name is hr_holidays.


From the code below, our module implements a view that inherits from the hr_holidays.view_hr_holidays_filter view [1] and add a very simple filter domain [2] after the existing department filter.


    <?xml version="1.0" encoding="utf-8"?>
    <odoo>
       <record id="al_hr_holidays.al_view_hr_holidays_filter" model="ir.ui.view">
          <field name="name">al.hr.holidays.filter</field>
          <field name="model">hr.leave</field>
          <field name="mode">primary</field>
          <field name="priority">1</field>
          <field name="inherit_id" ref="hr_holidays.view_hr_holidays_filter"/>
          <field name="arch" type="xml">
               <xpath expr="//filter[@name='department']" position="after">
                <filter name="additional_filter"
                        string="Additional Filter"
                        domain="[('state', '=', 'confirm')]"/>
             </xpath>
          </field>
       </record>
    </odoo>


However, the additional_filter filter is not rendered in the search filter, even after making sure that:


  • The al_hr_holidays module has been updated
  • The External ID of the view we are inheriting is valid
  • The XPath expression is valid
  • There is no error in the Odoo log
  • The browser cache has been cleared


Any hints on how to fix this issue? also present in Odoo 18 enterprise


[1] hr_holidays.view_hr_holidays_filter view, line 38 

addons/hr_holidays/views/hr_leave_views.xml


[2] The filter selects the leaves that are in the confirm state

0
Avatar
Cancelar
Ray Carnes (ray)

You can modify/extend the Parent View with mode=primary. This creates a brand new View. In order to use this View you need to reference it somewhere in Odoo. Without referencing it, it will never be used.

AdaLabs Ltd
Autor

(edited comment)
Thanks Ray for your 2 amazing clarifications

Two way to fix the issue:

1. (recommended) Completely remove the 'mode' field, as it is not needed in our context.
2. Change the value of the 'mode' field from 'primary' to 'extension'

The documentation on the mode field is available here https://www.odoo.com/documentation/18.0/developer/reference/user_interface/view_records.html

Care should be taken when we copy an example from outside. Before reusing it, we should carefully understand the meaning of each field.

So we would use 'primary' mode for a new view that would however be based on another view. In this case, reference of the new view should be used to render the new content. That was not the case here, this is why the 'additional_filter' was not rendered in the parent view.

Avatar
Ray Carnes (ray)
Melhor resposta

MODE. 

PRIMARY means you are making a NEW View and need to define where this new View is used or it will never be used. 

It should be INHERIT if you want your change to be applied to an EXISTING View. 

0
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
Python: Retrieving filtered records Resolvido
filter python v18
Avatar
Avatar
Avatar
3
jul. 25
1882
Suggestions for global filtering data by company?
filter searchview odoo10
Avatar
Avatar
1
out. 22
4836
Why does Product search-view not show all products? Resolvido
filter product searchview
Avatar
Avatar
Avatar
Avatar
Avatar
7
mar. 17
14508
Problem with date filter BETWEEN two dates
filter date between v18
Avatar
Avatar
Avatar
2
mai. 25
1830
Search Bar Filter Customization
filter xml searchview searchbar
Avatar
0
nov. 24
1275
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