Thursday, January 16, 2020

explain reports in odoo

In this step we will explain reports in odoo 

There are many types of reports in odoo and we can classified these type depends on many bases so we can say 
  • we have reports that it's data passed to doc file (pdf reports , xls reports) 
  • we have report show data in the screen (graphic reports, pivot) 
  • we have reports that we can edit it's data 
Now we will start with pdf report :
actually Odoo uses a report engine based on QWeb, Twitter Bootstrap and Wkhtmltopdf.
and to create pdf report for one record in the database we can do it as bellow

(create pdf report for clinic.booking object as an example) 

  • create report template as bellow

        <template id="clinic_booking_report_temp">
            <t t-call="web.html_container">
                <t t-foreach="docs" t-as="doc">
                    <t t-call="web.external_layout">
                        <div class="page">  
                        </div>
                    </t>
                </t>
            </t>
        </template>

 
  • create report record which will call the template as bellow
       <report
            id="clinic_booking_report_action"
            string="Booking Report"
            model="clinic.booking"
            report_type="qweb-pdf"
            name="clinic.clinic_booking_report_temp"
            menu="True"
        /> 
  • define paper format (optional)
       <record id="paperformat_euro_no_margin" model="report.paperformat">
            <field name="name">European A4</field>
            <field name="default" eval="True" />
            <field name="format">A4</field>
            <field name="page_height">0</field>
            <field name="page_width">0</field>
            <field name="orientation">Portrait</field>
            <field name="margin_top">40</field>
            <field name="margin_bottom">28</field>
            <field name="margin_left">7</field>
            <field name="margin_right">7</field>
            <field name="header_line" eval="False" />
            <field name="header_spacing">0</field>
            <field name="dpi">90</field>
        </record>


Watch On YouTube


PREVIOUS STEP             NEXT STEP

No comments:

Post a Comment

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...