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
    • eLearning
    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
    • Información
    • 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

Qweb Report based on wizard started from a menu!

Suscribirse

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

Se marcó esta pregunta
wizardqweb
2 Respuestas
9994 Vistas
Avatar
Matjaz

I am trying to create a qweb report that is not based on certain record of module, but I would create a dictionary of records

and pass them to qweb template. I've done this on RML reports but here 'data['form'] is not recognized of qweb template. Data is empty.

User starts a wizard from a menu, where he selects month and year. After that data is prepared as a dictionary and is passed to the report.

Wizard part:

datas = {
     'ids': ids,
, 'model': 'report.environmental.oils.wizard',
 'form': data
}
return {
     'type': 'ir.actions.report.xml',
     'report_name': 'mga_reports.report_environmental_oils',
data': datas, }

Report declaration:

<report        
id="action_report_environmental_oils"     
model="report.environmental.oils.wizard"     
name="mga_reports.report_environmental_oils"     
file="mga_reports.report_environmental_oils"     
report_type="qweb-pdf"     
menu="False"     
string="Environmental oils report"/>


I am not sure what model should I use in report definition, because report is not based on one, data will be computed from several one. I have also created parser file and data argument that comes in is empty

@api.multidef render_html(self, data=None):    
    report_obj = self.env['report']
    report = report_obj._get_report_from_name('mga_reports.report_environmental_oils')
    docargs = {
        'doc_ids': self._ids,
        'doc_model': report.model,
        'docs': self,          
} return report_obj.render('mga_reports.report_environmental_oils', docargs)


When I use data in qweb template data is empty in a got error.

<p t-esc="data['form']['date_from']"/>


Could someone help me with that case. I'm kind of lost... :-(

0
Avatar
Descartar
Avatar
Matjaz
Autor Mejor respuesta

Thanks Axel,

I already have parser with render_html method and since I have an id from wizard I can do all the 'calculation' / preparing data dictionary there and than pass than dictionary to docargs. It just took me a day of tests to find out that dictionary passed to docargs in parser class are recognized in Qweb template while passing it as a result of wizard as (data or datas) not.

@api.multi
def render_html(self, data=None):
         report_obj = self.env['report']
         report = report_obj._get_report_from_name('mga_reports.report_environmental_oils')
         dict_mydata = { ..do some calculation and prepare a dictionary.. }
         docargs = {
             'doc_ids': self._ids,
             'doc_model': report.model,
             'docs': self,
           'mydata': dict_mydata
        }
        return report_obj.render('mga_reports.report_environmental_oils', docargs)

But a lot of reports in Odoo are done as passing as a result of wizard, but all are based on certain model and mine doesn't.

Ok, I found a solution, but If someone has an answer to why do I have to use parser and Odoo reports doesn't....

0
Avatar
Descartar
Avatar
Axel Mendoza
Mejor respuesta

You are good to go with your code and the only way to receive the data in your parser is implementing the parser using an AbstractModel with the render_html method. The only thing is that 'datas' is what it's expected in the report controller to call your parser. You need to change your code:

return {

'type': 'ir.actions.report.xml',

'report_name': 'mga_reports.report_environmental_oils',

'datas': datas,

It's a bug or something missed on the get_action method of the report module that use 'data' instead of 'datas' in the return dict, but datas find it's way to the parser ok

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
Publicaciones relacionadas Respuestas Vistas Actividad
[odoo9] : Report content and header footer issue with wizard
wizard qweb odoo9
Avatar
Avatar
1
sept 17
5306
How can i use values from a print wizard in a qweb parser method?
wizard qweb parser
Avatar
0
abr 15
4724
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
jul 25
2980
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Avatar
Avatar
1
may 25
3766
QWeb: use t-if to check birthday date Resuelto
qweb
Avatar
Avatar
1
abr 25
3260
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