Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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.

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
configurationdebug
2 Antwoorden
171 Weergaven
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
Annuleer
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
Beste antwoord

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
Annuleer
Avatar
Abhas Maskey
Auteur Beste antwoord

 In reports- 

Model Name  : product.template

Template Name :product.report_producttemplatelabel13x5

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


0
Avatar
Annuleer
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.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
Odoo18 community crashes after more than a week of running smoothly
configuration debug
Avatar
Avatar
1
aug. 25
1424
Customizing "Search More" in Odoo Studio (Editing views)
configuration debug
Avatar
0
aug. 25
913
Setup script for on-premise Odoo
configuration debug
Avatar
0
jun. 25
1221
How to fix canonical links Opgelost
configuration debug
Avatar
Avatar
1
jun. 25
2073
[Aide] Modules custom non détectés ou non exécutés sur Odoo 18 (Windows)
development configuration debug
Avatar
Avatar
1
okt. 25
673
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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