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

Uncaught Odoo errors

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
settingsuncaughterrorsundefinedodoo
1 Responder
3120 Visualizações
Avatar
shraddha

In few product pages I am getting this error
UncaughtPromiseError > TypeError

Uncaught Promise > Cannot read properties of null (reading 'querySelectorAll')

TypeError: Cannot read properties of null (reading 'querySelectorAll')

    at Class.start (https://shop.testogcc.ae/web/assets/1/58ebb3c/web.assets_frontend_lazy.min.js:10652:2313)

    at prototype.<computed> [as start] (https://shop.testogcc.ae/web/assets/1/58ebb3c/web.assets_frontend_lazy.min.js:3372:516)

    at https://shop.testogcc.ae/web/assets/1/58ebb3c/web.assets_frontend_lazy.min.js:6166:13

    at async Promise.all (index 0)

    at async Promise.all (index 95)

    at async Promise.all (index 1)
And the JS is of 10K+ lines Can't understand how to fix it

0
Avatar
Cancelar
Mauricio Alejandro Gonzalez

maybe are you creating a new view or template in Odoo?

If you are, can you share the code with us, it will be useful for more context.

Avatar
Gracious Joseph
Melhor resposta

The error "Cannot read properties of null (reading 'querySelectorAll')" typically occurs when JavaScript is attempting to select an element on the page using querySelectorAll, but the element does not exist in the DOM at the time the code runs. This issue is common in dynamically rendered pages like Odoo's frontend.

Here's how to troubleshoot and resolve this issue:

1. Understand the Error

  • The error indicates that querySelectorAll is being called on null, meaning the parent element or DOM element being queried is not present when the script runs.
  • Likely causes:
    • Missing or improperly loaded HTML elements.
    • JavaScript code executing before the DOM is fully rendered.
    • A condition in the template or JS code that fails to include the required element.

2. Identify the Source of the Problem

To pinpoint the issue, follow these steps:

a. Check the Line of Failure

  • The error occurs in:
    at Class.start (web.assets_frontend_lazy.min.js:10652:2313)
    
  • The start method is likely in a widget or class responsible for handling a frontend feature.

b. Unminify the Code

  • If possible, replace the minified web.assets_frontend_lazy.min.js with the original (unminified) JS file for debugging. Alternatively, use browser developer tools' "Pretty Print" feature to format the code.

c. Reproduce the Error

  • Open the product page where the error occurs.
  • Inspect the console to confirm the line and the conditions under which the error is thrown.

d. Look for the Selector

  • The issue may involve a specific widget or feature using a query like:
    const elements = this.$el[0].querySelectorAll('.some-class');
    
  • Check the .some-class in the page source to see if it exists.

3. Debugging the Issue

a. Validate the HTML Structure

  • Use browser developer tools (F12 in most browsers) to inspect the product page.
  • Ensure all required elements exist in the DOM before the script runs.
  • Look for:
    • Missing elements (e.g., .some-class).
    • Improperly loaded assets.

b. Check for Dynamic Rendering

  • If the page relies on AJAX or lazy loading, the script might run before the elements are available.
  • Wrap the script inside a DOMContentLoaded or equivalent callback to ensure it executes after the DOM is ready:
    document.addEventListener('DOMContentLoaded', function () {
        const elements = document.querySelectorAll('.some-class');
        if (elements) {
            // Your logic here
        }
    });
    

c. Handle Null Checks

  • Add checks in the JavaScript code to ensure the element exists before calling querySelectorAll:
    const parentElement = document.querySelector('.parent-class');
    if (parentElement) {
        const elements = parentElement.querySelectorAll('.some-class');
        // Further processing
    }
    

4. Fixing the Root Cause

a. Verify the Template

  • If the error occurs in a specific Odoo template, ensure the required elements are present in the QWeb template.
  • Example:
    <div class="parent-class">
        <div class="some-class">Content</div>
    </div>
    
  • Missing or conditionally excluded elements can cause this error.

b. Customize the Widget

  • If the issue is in an Odoo widget (e.g., in start()), override the widget to include a null check.
    Example:
    const MyWidget = Widget.extend({
        start: async function () {
            const parentElement = this.$el[0];
            if (parentElement) {
                const elements = parentElement.querySelectorAll('.some-class');
                // Your logic
            }
            return this._super(...arguments);
        },
    });
    

c. Update Odoo or Assets

  • If this is caused by a bug in Odoo's assets:
    • Update to the latest Odoo version to include any patches or fixes.
    • Rebuild the assets:
      ./odoo-bin -c odoo.conf --dev=assets
      

5. Advanced Debugging

a. Use Breakpoints

  • Set a breakpoint at the erroring line using browser developer tools.
  • Inspect the variables and DOM state at runtime to understand why the element is missing.

b. Disable Third-Party Modules

  • Temporarily disable custom or third-party modules that may modify product pages.
  • Test if the error persists with only Odoo's default configuration.

c. Rebuild Assets

  • Clear and regenerate frontend assets:
    ./odoo-bin -u all --dev=assets
    

6. Summary

  • This error is typically caused by missing elements or timing issues.
  • To resolve:
    1. Verify the DOM structure and ensure elements exist.
    2. Add null checks or delay the script execution until the DOM is ready.
    3. Customize the widget or template if needed.
    4. Update Odoo and rebuild assets to ensure you're using the latest fixes.

If the issue persists, provide additional details about the specific code or template causing the problem for more targeted assistance.

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
i see this Error:Uncaught Promise > Cannot read properties of undefined (reading 'Symbol(html)')
settings docs uncaught undefined v15
Avatar
Avatar
1
jan. 23
27156
I cannot access to setting due to an error " Cannot read properties of undefined (reading 'string')"
settings errors
Avatar
Avatar
Avatar
Avatar
Avatar
4
mar. 23
8614
How to add new value in Selection in Settings Resolvido
settings selection odoo
Avatar
Avatar
1
mai. 21
4638
Admin rights not working
settings users administration odoo
Avatar
Avatar
1
fev. 24
3095
How to disable export for no admin users in Odoo Studio?
settings export odoo Studio
Avatar
0
jun. 23
2603
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