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
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    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

Additional label formats

Abonare

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

Această întrebare a fost marcată
reportinglabelsv15
1 Răspunde
6133 Vizualizări
Imagine profil
Eauzon

I was trying to add aditional label formats using this module code:


from collections import defaultdict
from odoo import fields, models


class ProductLabelLayout(models.TransientModel):
_inherit = 'product.label.layout'

print_format = fields.Selection(selection_add=[
('2x4', '2 x 4')
], ondelete={'2x4': 'set default'})


And i thought that would do it, but it leads to an error. Any ideas ?


load could not load template
ValueError: Invalid template id: ''
Template: product.report_productlabel


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

You need to try this code.When we create new selection field on the prin_format you must add new functions for that types and need to create new printing format

from collections import defaultdict
from odoo import fields, models,
_
from odoo.exceptions import UserError


class ProductLabelLayout(models.TransientModel):
_inherit =
'product.label.layout'

print_format = fields.Selection(selection_add=[
    (
'price_card', 'Price Card'), ], ondelete={'price_card': 'set default'})

def _prepare_report_data(self):
    xml_id, data =
super()._prepare_report_data()

   
if 'price_card' in self.print_format:
        xml_id =
module_name.report_product_label_product_price_tag'

        active_model =
''
       
if self.product_tmpl_ids:
            products =
self.product_tmpl_ids.ids
            active_model =
'product.template'
        elif
self.product_ids:
            products =
self.product_ids.ids
            active_model =
'product.product'
        price = format(
self.product_tmpl_ids.list_price, ".2f")
        data = {
           
'active_model': active_model,
           
'product_tmpl_name': self.product_tmpl_ids.name,
           
'product_tmpl_price': price,
           
'product_tmpl': self.product_tmpl_ids,
           
'product_name': self.product_ids.name,
           
'product_id': self.product_ids,
        }
   
return xml_id, data

def process(self):
    action =
super(ProductLabelLayout, self).process()
   
self.ensure_one()
    xml_id, data =
self._prepare_report_data()
   
if not xml_id:
        raise UserError(
_('Unable to find report template for %s format', self.print_format))
    report_action =
self.env.ref(xml_id).report_action(None, data=data)
    report_action.update({
'close_on_report_download': True})
   
return action

Also, try to add the paper format and further details

<record id="paperformat_product_price_tag" model="report.paperformat">
    <field name="name">Price Card Label</field>
    <field name="default" eval="True"/>
    <field name="format">custom</field>
    <field name="page_height">267</field>
    <field name="page_width">175</field>
    <field name="orientation">Landscape</field>
    <field name="margin_top">0</field>
    <field name="margin_bottom">0</field>
    <field name="margin_left">0</field>
    <field name="margin_right">0</field>
    <field name="disable_shrinking" eval="True"/>
    <field name="header_line" eval="False"/>
    <field name="header_spacing">0</field>
    <field name="dpi">96</field>
</record>
<record id="report_product_label_product_price_tag" model="ir.actions.report">
 
  <field name="name">Product Price Card</field>
    <field name="model">product.template</field>
    <field name="report_type">qweb-pdf</field>
    <field name="report_name">module_name.report_product_price_tag</field>
    <field name="report_file">module_name.report_product_price_tag</field>
    <field name="binding_type">report</field>
    <field name="binding_model_id" ref="model_product_template"/>
    <field name="paperformat_id" ref="paperformat_product_price_tag"/>
</record>
<template id="report_product_price_tag">
    //content
</template>




Hope it helps

1
Imagine profil
Abandonează
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
ODOO 15 for "Einnahmenüberschussrechnung EÜR"
reporting v15
Imagine profil
Imagine profil
Imagine profil
2
aug. 25
3926
report layout generates error on pdf export but works in preview
reporting v15
Imagine profil
Imagine profil
1
apr. 25
5369
Reports: table headers repeating PO vs SO Rezolvat
reporting v15
Imagine profil
Imagine profil
2
iul. 24
6955
Insert image into a report Rezolvat
reporting v15
Imagine profil
Imagine profil
1
apr. 24
2699
V15 - Multiple IoT boxes with label printers
labels iot v15
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
mai 24
3259
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