Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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.

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
configurationdebug
2 Răspunsuri
148 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
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.

Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Abhas Maskey
Autor Cel mai bun răspuns

 In reports- 

Model Name  : product.template

Template Name :product.report_producttemplatelabel13x5

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


0
Imagine profil
Abandonează
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.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Odoo18 community crashes after more than a week of running smoothly
configuration debug
Imagine profil
Imagine profil
1
aug. 25
1412
Customizing "Search More" in Odoo Studio (Editing views)
configuration debug
Imagine profil
0
aug. 25
910
Setup script for on-premise Odoo
configuration debug
Imagine profil
0
iun. 25
1211
How to fix canonical links Rezolvat
configuration debug
Imagine profil
Imagine profil
1
iun. 25
2055
[Aide] Modules custom non détectés ou non exécutés sur Odoo 18 (Windows)
development configuration debug
Imagine profil
Imagine profil
1
oct. 25
653
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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