Join the Odoo Inner Circle to view the premium video below.
Creating Custom Reports - Mastering Odoo 9 Development Part 8
Topics
Introduction: Creating Custom Reports in Odoo using qweb
0:00:01
Using report templates and existing source code to build reports
0:01:25
Creating our first report definition and adding the report to the model print menu
0:05:37
Creating the report template and tying it to the report
0:06:55
Testing the report
0:10:54
Adding additional custom fields to our new report template
0:12:12
Upgrading Wktohtmlpdf to eliminate Odoo report warnings
0:14:50
Learn to report data from related models in Odoo reports
0:19:10

Creating Custom Reports - Mastering Odoo 9 Development Part 8

25.00 25.0 USD

25.00

Free with Odoo Inner Circle Add to Cart

Section 8: Odoo uses a powerful reporting engine that allows you to create custom reports from within Odoo. In this video you learn how to create an Odoo report template, call the report for a menu, and learn how to use qWeb to loop through datasets to report information. Even better, you can build on these fundamentals and be prepared for more advanced web interfaces.

Video Length:   31 Minutes
Free With Odoo Inner Circle

This course is now available on Udemy!

Odoo Class Subscribers can redeem their free Udemy coupon above  

Mastering Essential Odoo Development Skills

In this section explore Odoo's report engine and ability to produce PDF files. We begin by looking at an overview of Odoo's reporting engine and learn how to navigate Odoo's source code to find examples of Odoo report templates and menus. 

Some installations of Odoo have issues with having the correct version of Odoo's print engine Wkhtmltopdf that converts Odoo qWeb templates into a PDF file. In this video you will learn how to patch Odoo to handle changes with the reporting engine.

Finally we look at how to loop through Odoo models and data sets to create more complex reports in Odoo.

Odoo image and text block

Steps to creating a custom report in Odoo

If you are new to reporting in Odoo then this course will certainly help you understand the basics and framework for creating a report in Odoo. From a development perspective the first steps are to understand the models that you need to pull data from. In our video example we demonstrate how to pull data from the product model that you have developed with your own custom fields.  

After you know the models you need to reference you can use the qWeb code to display the fields you need on your report. 

Creating a custom Odoo Report  

Source code from the video tutorial

Creating a custom report in Odoo is much like creating any other view. Use the <template> keyword to wrap your report. The <t> tag is used to separate elements in your report.

Here is a code example that you can use to help you get started. The video tutorial above walks you through developing the custom report and integrating it with a menu in Odoo step by step.

<template id= "product.nutrition">
    <t t-call="report.html_container">
         <t t-foreach="docs" t-as = "o">
             <t t-call ="report.external_layout">
                 <div class="page" >
                     <div class="oe_structure" />
                     <h1>Nutrition Report</h1>
                     <h2>Product Name: <span t-field="o.name"/>
                 </div>
             </t>
         </t>
     </t>
</template>


Understanding the qWeb Tags and attributes

Each tag in qweb is used by the engine to process the report. Here are some of the more important tags we are using to build our custom report.

 

<template>
The template tag is the main wrapper for your report. 
t-call
The t-call attribute tell the qweb engine to call another report template and process it. This is the main mechanism to create sub-reports. To create complex reports in Odoo you will need to use t-call so that you can process multiple datasets.
t-foreach
The t-foreach attribute loops through the data structure you provide. In this example the dataset is "docs". Each record is then placed into the variable specified in t-as. In this case the variable is  "o".
t-field
Use t-field to specify the field from the dataset you wish to display on the report.


Why should I choose Mastering Odoo 9 Development?

First of all this course is comprehensive. Never used Ubuntu or written an Odoo application before? Not a problem. We start at the very beginning from setting up Odoo to creating your first Odoo application from scratch. We even include an Odoo Python Primer to help introduce you to the very basics of Odoo Development. As an Odoo Class Subscriber Mastering Odoo 9 Development is your foundation course for understanding more advanced Odoo Development videos. If you are new to Odoo Development, this is the first course you will want to watch.

Understanding Odoo Class Master Courses

With this new course we will be better identifying our more important video courses that we release on Odoo Class. These courses are foundation courses that have many hours of content to teach you the fundamentals of Odoo. Like our Odoo 9 Essentials course, this course provides you the fundamentals you need for developing Odoo 9 Applications. Future Odoo developer videos and courses will build on these essential Odoo developer topics.

Get Started Learning to Develop Odoo Applications

The entire purpose of this video course is to give you everything you need to get started developing applications in Odoo. Even if you don't have Odoo running on your computer... we have you covered and show you how to install a virtual Ubuntu Desktop right on your Windows machine. See step by step how to install Odoo with source code from git hub. See behind the scenes of the Odoo application and peek into how the Odoo framework fits together.