Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Qweb Report based on wizard started from a menu!

Subscriure's

Get notified when there's activity on this post

This question has been flagged
wizardqweb
2 Respostes
10005 Vistes
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 Best Answer

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
Best Answer

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
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
[odoo9] : Report content and header footer issue with wizard
wizard qweb odoo9
Avatar
Avatar
1
de set. 17
5317
How can i use values from a print wizard in a qweb parser method?
wizard qweb parser
Avatar
0
d’abr. 15
4736
Odoo 18: Display image from char field containing url in qweb form
qweb
Avatar
Avatar
1
de jul. 25
2987
PDF Export Option for QWeb Reports in odoo 17.0
qweb
Avatar
Avatar
1
de maig 25
3778
QWeb: use t-if to check birthday date Solved
qweb
Avatar
Avatar
1
d’abr. 25
3268
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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