Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
deliverydeliverynoteInventory
4 Respuestas
1772 Vistas
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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

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
Descartar
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 Mejor respuesta

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
Descartar
Avatar
Piyush H
Mejor respuesta

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
Descartar
Avatar
DataInteger Consultancy Services LLP
Mejor respuesta
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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Delivery Note in Repair
delivery repair deliverynote
Avatar
Avatar
1
ago 20
3889
Quant's editing is restricted, you can't do this operation.
Inventory
Avatar
Avatar
Avatar
2
nov 25
410
Error with Check Status
delivery
Avatar
0
sept 25
820
Odoo module to allow customers to sign off on delivery slip Resuelto
delivery signature deliverynote deliveryslip v14
Avatar
Avatar
Avatar
2
ago 25
6669
How to attach specific locations to products
Inventory
Avatar
Avatar
Avatar
2
ago 25
1422
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Website made with

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