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

After validate the delivery slip is not comes up but get error code

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
deliverydeliverynoteInventory
4 Respostas
1782 Visualizações
Avatar
Mickey

Hi i try to validate delivery but get error message and delivery slip is not create.

Do you know to to solve this problem?


RPC_ERROR

Odoo Server Error


Traceback (most recent call last):
  File "<198>", line 142, in template_198
  File "<198>", line 42, in template_198_content
KeyError: 'doc'

 

1
Avatar
Cancelar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Melhor resposta

Hi,


The error KeyError: 'doc' happens when the delivery slip report tries to use a variable doc that hasn’t been defined.


Odoo provides a variable called docs (a list of records), but the template is using doc without setting it first.


This usually happens in a custom module or a modified delivery slip report template.


To check this, activate Developer Mode > go to Technical > Reports > Reports > search for Delivery Slip > open the related QWeb template.


If you see something like <t t-esc="doc.name"/>, but there’s no doc defined, that’s the cause of the error.


To fix it, add <t t-set="doc" t-value="docs[0]"/> before using doc if only one record is printed.


If the report is for multiple deliveries, wrap your code in <t t-foreach="docs" t-as="doc"> ... </t> to make doc available.


After updating the template, upgrade your custom module and try validating the delivery again-the slip should now be created without errors.



Hope it helps

1
Avatar
Cancelar
Mickey
Autor

I followed your instruction but key error is change to "o"

odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
KeyError: 'o'
Template: stock.report_delivery_document
Path: /t/t/t/t[2]
Node: <t t-set="partner" t-value="o.partner_id or (o.move_ids and o.move_ids[0].partner_id) or False"/>

code i updated as below; in report_deliveryslip

<t t-name="stock.report_deliveryslip">
<t t-set="doc" t-value="docs[0]"/>
<t t-foreach="docs" t-as="doc">
<t t-call="stock.report_delivery_document" t-lang="doc._get_report_lang()"/>
</t>
</t>

Avatar
Mickey
Autor Melhor resposta

Finally, i did go to the template : web.address_layout (Customize by studioX)

 and delete  "Inherited View" and all work deliveryslip can print out.


Thank you for all help.


I appreciated.

0
Avatar
Cancelar
Avatar
Piyush H
Melhor resposta

The error message KeyError: 'doc' in Odoo when validating a delivery slip indicates that the system is trying to access a variable or key named 'doc' that doesn't exist in the template or code being executed. This often occurs during the report generation process.

Here are steps to troubleshoot and resolve this problem:

1. Identify the specific report template:

  • The traceback indicates the error is within a template file <198>. You'll need to find the exact name of the delivery slip template being used.
  • In Odoo, go to Settings > Technical > Reporting > Reports. Search for "Delivery Slip" or a similar name related to delivery operations.
  • Once you find the report, examine its External ID (e.g., stock.report_delivery_slip). This ID helps identify the associated QWeb template.
  • Then, navigate to Settings > Technical > User Interface > Views and search for the external ID of the report to find the corresponding view.

2. Examine the QWeb template:

  • Open the QWeb view identified in the previous step.
  • Carefully review the template code, looking for where the variable doc is used. The error KeyError: 'doc' means that the code is trying to access a dictionary key or object property named doc, but it's not available in the context.
  • Possible causes:
    • Typo: A simple typo in the template code when referencing doc.
    • Missing Definition: The variable doc is not being properly passed or defined within the template's context.
    • Incorrect Context: The template is expecting a different type of object than what's being provided.

3. Check the report's Python code:

  • The QWeb template receives its data from a Python class. You need to find the Python code that generates the data for the delivery slip report.
  • Go to Settings > Technical > Actions > Reports. Find the delivery slip report. Check the "Model" field. This tells you which Odoo model is used as the basis for the report (e.g., stock.picking).
  • Examine the code related to that model, especially any methods that are called when generating the delivery slip. Look for how the doc variable (or its equivalent) is being prepared and passed to the QWeb template.
  • Possible issues:
    • The Python code is not correctly fetching or preparing the data that the template expects.
    • The doc variable is not being added to the context dictionary that's passed to the template.

4. Solutions

  • Correct the template: If there's a typo or missing definition in the QWeb template, fix it. Ensure that doc is correctly referenced and that all necessary data is available in the template's context.
  • Modify the Python code: If the Python code is not providing the correct data, adjust it to fetch the required information and pass it to the template. Make sure the doc variable (or its equivalent) is properly populated.
  • Check for customizations: If you or someone else has customized the delivery slip report, review those changes carefully. Customizations are often the source of such errors.
  • Update Odoo: If you're using an older version of Odoo, consider updating to the latest stable release. Bug fixes and improvements in newer versions might resolve the issue.
  • Check installed modules: In some cases, this error can be caused by a faulty or incompatible module. Try disabling recently installed modules to see if that resolves the issue.

Example Scenario and Solution

Let's say the delivery slip template has this line:

<span t-esc="doc.name"/>

And the Python code preparing the data looks like this:

def _get_report_values(self, docids, data=None):
    docs = self.env['stock.picking'].browse(docids)
    return {
        'doc_ids': docids,
        'doc': docs,
    }

In this case, doc is a collection of stock.picking records. To access the name of the first record, you should modify the template:

<span t-esc="doc[0].name"/>

0
Avatar
Cancelar
Avatar
DataInteger Consultancy Services LLP
Melhor resposta
Cause

Your QWeb report (usually stock.report_deliveryslip_document ) tries to use the variable doc , but it's not defined .

In Odoo, the report engine passes a variable called docs (a recordset). If you use doc , you must define it first.


Step-by-Step Fix:
  1. Go to Developer Mode
    • Activate Developer Mode in Odoo.
  2. Navigate to QWeb Views
    • Menu: Technical → User Interface → Views
    • Search for the delivery slip template:
      Example: stock.report_deliveryslip_document (or your custom report)
  3. Edit the Template

At the top of the XML , add this line right after the opening <t> tag:

<t t-set="doc" t-value="docs[0]"/>
Example of Correct Template Structure
<t t-name="stock.report_deliveryslip_document">
  <t t-call="web.html_container">
    <t t-set="doc" t-value="docs[0]"/> <!-- ✅ Fix line -->
    <div class="page">
      <h2 t-esc="doc.name"/> <!-- Example usage -->
      <p t-esc="doc.partner_id.name"/>
      <!-- Your report content -->
    </div>
  </t-call>
</t>

This sets doc = docs[0] , so all your t-esc="doc.xyz" calls now work.

Why This Fix Works
  • docs is the standard list of records Odoo passes into QWeb reports.
  • If you're using doc , but it isn't defined from docs[0] , you get a KeyError .


Thanks & Regards,

Email: contact@datainteger.com 

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
Delivery Note in Repair
delivery repair deliverynote
Avatar
Avatar
1
ago. 20
3892
Quant's editing is restricted, you can't do this operation.
Inventory
Avatar
Avatar
Avatar
2
nov. 25
414
Error with Check Status
delivery
Avatar
0
set. 25
824
Odoo module to allow customers to sign off on delivery slip Resolvido
delivery signature deliverynote deliveryslip v14
Avatar
Avatar
Avatar
2
ago. 25
6672
How to attach specific locations to products
Inventory
Avatar
Avatar
Avatar
2
ago. 25
1428
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