Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Error when trying to print custom report (Ver 12)

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
2 Respuestas
6339 Vistas
Avatar
Steven Deweirt

So I wrote a custom module that defines a custom report:

<odoo>
<report
id="report_product_test_zebra"
string="Product zebra test"
model="product.template"
report_type="qweb-pdf"
name="test_wizard.report_product_test_zebra"
file="report_producttestzebra"
print_report_name="TestZebra print"
/>
</odoo>

<odoo>

<template id="report_producttestzebra">

<t t-foreach="docs" t-as="template">

<t t-foreach="template.product_variant_ids" t-as="product">
<div class="page" style="page-break-after: always; margin-left:4px">
<div style="text-align: center">
<strong style="font-size:14px;" t-field="product.name"/>

<t t-if="product.barcode">

<img alt="Barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 700, 200)" style="width:100%;height:20mm;"/>

<span style="font-size: 14px;" t-field="product.barcode"/>

</t>
</div>
        </div>
</t>
</t>
</template>
</odoo>

Then I defined a model for a wizard:

class PrintMultipleWizard(models.TransientModel):
_name = 'print.multiple_wizard'
_description: 'Multiple labels'

prod_ids = fields.Many2many('product.template', string='products')
#aantal = fields.Int(help="aantal dat moet afgedrukt worden")

@api.model
def default_get(self, field_names):
defaults = super(PrintMultipleWizard, self).default_get(field_names)
defaults['prod_ids'] = self.env.context['active_ids']
prod_ids = self.env.context.get('active_ids', [])
return defaults

@api.multi
def do_mass_print(self):
self.ensure_one()
actieve_ids = self._context.get('active_ids')
products_to_print = self.env['product.template'].browse(actieve_ids)

datas = {'ids': self.env.context.get('active_ids', [])}
res = self.read(['prod_ids'])

datas['form'] = res
return self.env.ref('test_wizard.report_product_test_zebra').report_action([], data=datas)

I also defined the wizard itself:

<odoo>
<record id="TestPrintModel" model="ir.ui.view">
<field name="name">Test print aantal labels</field>
<field name="model">print.multiple_wizard</field>
<field name="arch" type="xml">

<form>
<field name="prod_ids">
<tree>
<field name="name"/>
</tree>
</field>

<footer>
<button type="object" name="do_mass_print"
string="Do it" class="oe_highlight"
/>
<button special="cancel" string="Cancel"/>
</footer>

</form>

</field>
</record>

<!--More button Action-->
<act_window id="action_test_print_multiple"
name="print multiple labels"
src_model="product.template"
res_model="print.multiple_wizard"
view_mode="form"
target="new"
multi="True"
/>
</odoo>

Now, after I press the button to print, I get the following error:

Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_portal_frontend_layout_302
  File "<template>", line 2, in body_call_content_301
AttributeError: 'NoneType' object has no attribute 'id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1675, in report_download
    response = self.report_routes(reportname, converter=converter, **dict(data))
  File "/opt/odoo/odoo/odoo/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1612, in report_routes
    pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
  File "/opt/odoo/odoo/custom_addons/base_report_to_printer/models/ir_actions_report.py", line 146, in render_qweb_pdf
    res_ids=res_ids, data=data)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 682, in render_qweb_pdf
    html = self.with_context(context).render_qweb_html(res_ids, data=data)[0]
  File "/opt/odoo/odoo/enterprise/web_studio/models/ir_actions_report.py", line 15, in render_qweb_html
    return super(IrActionsReport, self).render_qweb_html(docids, data)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 722, in render_qweb_html
    return self.render_template(self.report_name, data), 'html'
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 505, in render_template
    return view_obj.render_template(template, values)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_ui_view.py", line 1284, in render_template
    return self.browse(self.get_view_id(template)).render(values, engine)
  File "/opt/odoo/odoo/addons/website/models/ir_ui_view.py", line 318, in render
    return super(View, self).render(values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/opt/odoo/odoo/addons/web_editor/models/ir_ui_view.py", line 27, in render
    return super(IrUiView, self).render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_ui_view.py", line 1293, in render
    return self.env[engine].render(self.id, qcontext)
  File "/opt/odoo/odoo/enterprise/web_studio/models/ir_qweb.py", line 43, in render
    return super(IrQWeb, self).render(template, values=values, **options)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_qweb.py", line 59, in render
    result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 274, in render
    self.compile(template, options)(self, body.append, values or {})
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 348, in _compiled_fn
    raise e
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_772_254
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 353, in _compiled_fn
    raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
odoo.addons.base.models.qweb.QWebException: 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_portal_frontend_layout_302
  File "<template>", line 2, in body_call_content_301
AttributeError: 'NoneType' object has no attribute 'id'

Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'id'
Template: portal.frontend_layout
Path: /templates/t/t/t[4]
Node: <t t-set="x_icon" t-value="'/web/image/website/%s/favicon/' % website.id"/>
    

Anybody have any idea what exactly is going wrong here? Thanks in advance!

0
Avatar
Descartar
Avatar
Niyas Raphy (Walnut Software Solutions)
Mejor respuesta

Hi,

From the error message it says that the variable named website is not record set, might be it is not receiving value in it.


Check and ensure that the website variable contain values.


Thanks

0
Avatar
Descartar
Avatar
Alberto Rubio
Mejor respuesta

Obviously, website variable is not receiving any value in it.
Did you find any solution on that? Im on that mess aswell.
I will apreciate any answer.

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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