Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • 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
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

Problem with wizard qweb report and base_report_to_printer

Odoberať

Get notified when there's activity on this post

This question has been flagged
wizardprinterqwebqweb-report
1 Odpoveď
6173 Zobrazenia
Avatar
Gabriel Caceres Cabriza

Hello,
We are currently using the base_report_to_printer module and  its just almost perfect for the needs of our customers. We have one problem printing a qweb wizard based report. If the report its configured with the "Send to client" behaviour it works fine, but, when we try to sent to printer, it give us the following error:
```

  File "/home/gcc/PycharmProjects/gigigogo/addons/base_report_to_printer/models/ir_actions_report.py", line 106, in print_document
    record_ids, data=data)
  File "/home/gcc/PycharmProjects/gigigogo/addons/base_report_to_printer/models/ir_actions_report.py", line 139, in render_qweb_pdf
    docids, data=data)
  File "/home/gcc/PycharmProjects/gigigogo/addons/base/ir/ir_actions_report.py", line 596, in render_qweb_pdf
    Model = self.env[self.model]
  File "/home/gcc/odoo/odoo11/odoo/api.py", line 760, in __getitem__
    return self.registry[model_name]._browse((), self)
  File "/home/gcc/odoo/odoo11/odoo/modules/registry.py", line 181, in __getitem__
    return self.models[model_name]
KeyError: False
```

All the reports are sending fine to the printer, except for this one.

**Wizard python code:**
```python

# -*- coding: utf-8 -*-
from odoo import fields, models, exceptions, api
from datetime import datetime, timedelta
from lxml import etree
from odoo.exceptions import ValidationError

class BarcodeWizard(models.Model):
    _name='barcode.wizard'

    product_id = fields.Many2one('product.template','Producto',required=True)
    copias = fields.Integer(string="Cantidad de copias",default=1,required=True)
    name=fields.Char(related="product_id.name")
    # product_name = fields.Char(related="product_id.name")
    # product_barcode = fields.Char(related="product_id.barcode")


    @api.multi
    def imprimir_reporte(self):
        if self.product_id.barcode:

            return self.env.ref('gigigogo.report_product_etiqueta_wizard_action').report_action(self)
        else:
            raise ValidationError('Favor registrar código de barras del producto')
```
**Xml wizard code:**


```xml
<odoo>
    <data>
        <record id="barcode_wizard_report_view" model="ir.ui.view">
            <field name="name">barcode.wizard</field>
            <field name="model">barcode.wizard</field>
            <field name="arch" type="xml">
               <form>
                   <group>
                       <field name="product_id"/>
                       <field name="copias"/>
                   </group>
                   <footer>
                       <button name="imprimir_reporte" string="Imprimir etiquetas" type="object" class="oe_highlight"/>
                       <button string="Cancelar" class="oe_link" special="cancel"/>
                   </footer>
               </form>
            </field>
        </record>


        <act_window
            name="Imprimir etiquetas"
            res_model="barcode.wizard"
            src_model="product.template"
            view_mode="form"
            target="new"
            context="{'default_product_id':active_id}"
            key2="client_action_multi"
            id="action_imprimir_etiquetas"/>



    </data>
</odoo>
```
**Barcode wizard report xml**

```xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <report
            id="report_product_etiqueta_wizard_action"
            string="Etiqueta"
            model="barcode.wizard"
            report_type="qweb-pdf"
            name="gigigogo.product_etiqueta_report_wizard"
            file="gigigogo.product_etiqueta_report_wizard"
            print_report_name="'Etiqueta - %s' % (object.name)"
            paperformat="gigigogo.paperformat_etiqueta"

        />
    </data>

    <template id="report_simple_etiqueta_wizard">
    <div class="col-xs-6" style="padding:0;" >
        <table style="border-spacing:0;margin-bottom:0;margin-top:10px;height:110px;" class="table">
            <thead>
                <tr style="width: 3in;">
                    <td style="border: 2px solid black;width: 2.63in;" colspan="2" class="col-xs-8 danger">
                        <t t-if="product.product_id.default_code">
                            [<strong t-field="product.product_id.default_code"/>]
                        </t>
                        <strong t-field="product.product_id.name"/>
                    </td>
                </tr>
            </thead>
            <tbody>
                <tr style="width: 1in;">
                    <td style="border: 2px solid black;text-align: center; vertical-align: middle;" class="col-xs-5">
                        <img t-if="product.product_id.barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.product_id.barcode, 600, 150)" style="width:100%;height:20%;"/>
                        <span t-field="product.product_id.barcode"/>
                    </td>
                    <td style="border: 2px solid black; text-align: center;" class="col-xs-7">
                        <h4>
                            <strong t-field="product.product_id.company_id.currency_id.symbol"/>
                            <strong t-field="product.product_id.list_price"/>
                        </h4>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-xs-6" style="padding:0;">
        <table style="border-spacing:0;margin-bottom:0;margin-top:10px;height:110px;" class="table">
            <thead>
                <tr style="width: 3in;">
                    <td style="border: 2px solid black;width: 2.63in;" colspan="2" class="col-xs-8 danger">
                        <t t-if="product.product_id.default_code">
                            [<strong t-field="product.product_id.default_code"/>]
                        </t>
                        <strong t-field="product.product_id.name"/>
                    </td>
                </tr>
            </thead>
            <tbody>
                <tr style="width: 1in;">
                    <td style="border: 2px solid black;text-align: center; vertical-align: middle;" class="col-xs-5">
                        <img t-if="product.product_id.barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.product_id.barcode, 600, 150)" style="width:100%;height:20%;"/>
                        <span t-field="product.product_id.barcode"/>
                    </td>
                    <td style="border: 2px solid black; text-align: center;" class="col-xs-7">
                        <h4>
                            <strong t-field="product.product_id.company_id.currency_id.symbol"/>
                            <strong t-field="product.product_id.list_price"/>
                        </h4>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div>
        <p style="page-break-after: always;"/>
    </div>

</template>

<template id="product_etiqueta_report_wizard">
    <t t-call="web.basic_layout">
        <div class="page">
            <t t-foreach="docs" t-as="product">
                <t t-foreach="range(product.copias)" t-as="n">
                    <t t-call="gigigogo.report_simple_etiqueta_wizard">
                        <t t-set="product" t-value="product"/>
                    </t>
                </t>
            </t>
        </div>
    </t>
</template>


</odoo>
```
Any solution for the problem? The problem its only with wizards. If we use the report outside the wizard it works perfect.

Thanks in advance.

Best regards.

**Gabriel Cáceres Cabriza**


0
Avatar
Zrušiť
Avatar
Mario Osvaldo Nuñez
Best Answer
The problem is that the document has a different commercial than the person who is logged in, check if the commercial field is different from your login, it must be the same or at least be empty
0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
[SOLVED]How to remove currency symbol from Monetary field qweb report ?
qweb qweb-report
Avatar
Avatar
Avatar
Avatar
7
okt 25
29621
Qweb Report based on wizard started from a menu!
wizard qweb
Avatar
Avatar
2
feb 16
10039
PDF and qweb customized
qweb qweb-report PDF
Avatar
Avatar
1
jan 24
2750
Custom filename QWEB report [ODOO 14.0]
qweb filename qweb-report
Avatar
Avatar
1
jún 23
5425
How to group by report using qweb based on my condition
qweb qweb-report odoo10
Avatar
Avatar
1
apr 22
10422
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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