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

How can I change the print labels in products <- inventory to include print barcode labels formatted for 38.1 mm × 21.2 mm (65 labels per A4 sheet, like Avery L7159/ST-65) from inside Odoo. Using the one App free community version.

Suscribirse

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

Se marcó esta pregunta
configurationdebug
2 Respuestas
192 Vistas
Avatar
Abhas Maskey

Hello I am using the  Odoo Version 19.0 Community Edition. I want to print a 13x5 product label  directly as a PDF like any other from the print labels.  I went into Developer Mode  to change things and I duplicated the default product label report and customized it for the 13x5 label format.

I’ve named the report Product Label 13x5 (PDF) and set the Model to product.template with the corresponding template (product.report_producttemplatelabel13x5). Even though the external ID exists in Settings → Technical → Database Structure → External Identifiers, Odoo is not recognizing it when I try to use it in the form view button.

Traceback (most recent call last):
  File "/home/odoo/src/odoo/19.0/odoo/tools/safe_eval.py", line 397, in safe_eval
    return unsafe_eval(c, globals_dict, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "ir.actions.server(331,)", line 2, in <module>
  File "/home/odoo/src/odoo/19.0/odoo/orm/models.py", line 6159, in mapped
    field = records._fields[field_name]
            ~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'product_tmpl_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/19.0/odoo/http.py", line 2266, in _serve_db
    return service_model.retrying(serve_func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/service/model.py", line 184, in retrying
    result = func()
             ^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/http.py", line 2313, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/http.py", line 2528, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_http.py", line 357, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/http.py", line 788, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/addons/web/controllers/action.py", line 58, in run
    result = action.run()
             ^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_actions.py", line 1177, in run
    res = action._run(records, eval_context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_actions.py", line 1190, in _run
    res = runner(run_self, eval_context=eval_context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/odoo/src/odoo/19.0/odoo/addons/base/models/ir_actions.py", line 1014, in _run_action_code_multi
    safe_eval(self.code.strip(), eval_context, mode="exec", filename=str(self))
  File "/home/odoo/src/odoo/19.0/odoo/tools/safe_eval.py", line 403, in safe_eval
    raise ValueError('%r while evaluating\n%r' % (e, expr))
ValueError: KeyError('product_tmpl_id') while evaluating
"if records:\r\n    templates = records.mapped('product_tmpl_id')  # map product variants to templates\r\n    templates.env.ref('custom.report_product_label_13x5').report_action(templates)"

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPC_ERROR
       

How to properly link the button to the report in the form view?

0
Avatar
Descartar
Codesphere Tech

Hello,
Can you tell me what you get in"records"? because error shows that records does not have a product_tmpl_id field.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,


The error occurs because your duplicated product label report is linked to the product.template model, while the default server action expects the product.product model. The standard print logic calls records.mapped('product_tmpl_id'), which exists only on product variants, not on templates, hence the KeyError.


To fix this, you have two options. The simplest is to change your report’s model back to product.product, matching Odoo’s default behavior. This allows the existing button code to work without modification and automatically prints labels for the corresponding product templates. Alternatively, if you prefer to keep the report on product.template, you must edit the server action code to remove the mapping and directly call report_action(records) instead.


Finally, make sure your report’s external ID matches the one defined in its XML configuration, and that your custom print button correctly references the related server action. In general, keeping the report model as product.product is the most compatible approach since it aligns with Odoo’s standard label printing workflow and reduces future maintenance issues.


Hope it helps

0
Avatar
Descartar
Avatar
Abhas Maskey
Autor Mejor respuesta

 In reports- 

Model Name  : product.template

Template Name :product.report_producttemplatelabel13x5

Printed Report Name? 'Products Labels - %s' % (object.name)


0
Avatar
Descartar
Codesphere Tech

I mean to ask that records are pointing to which model?

Codesphere Tech

If records is belong to product.template model then you can not access this field from its own model.. you need records of product.product. hope this helps.

¿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
[Peru telefono@ LATAM] ¿Cómo puedo comunicarme con Latam Perú?
configuration debug
Avatar
0
nov 25
9
Odoo18 community crashes after more than a week of running smoothly
configuration debug
Avatar
Avatar
1
ago 25
1465
Customizing "Search More" in Odoo Studio (Editing views)
configuration debug
Avatar
0
ago 25
933
Setup script for on-premise Odoo
configuration debug
Avatar
0
jun 25
1253
How to fix canonical links Resuelto
configuration debug
Avatar
Avatar
1
jun 25
2120
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