Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Problem with wizard qweb report and base_report_to_printer

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
wizardprinterqwebqweb-report
1 Rispondi
6165 Visualizzazioni
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
Abbandona
Avatar
Mario Osvaldo Nuñez
Risposta migliore
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
Abbandona
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
[SOLVED]How to remove currency symbol from Monetary field qweb report ?
qweb qweb-report
Avatar
Avatar
Avatar
Avatar
7
ott 25
29598
Qweb Report based on wizard started from a menu!
wizard qweb
Avatar
Avatar
2
feb 16
10033
PDF and qweb customized
qweb qweb-report PDF
Avatar
Avatar
1
gen 24
2703
Custom filename QWEB report [ODOO 14.0]
qweb filename qweb-report
Avatar
Avatar
1
giu 23
5409
How to group by report using qweb based on my condition
qweb qweb-report odoo10
Avatar
Avatar
1
apr 22
10415
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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