In every organization, the progress of their business growth is handled by reporting. Whereas in Odoo, reporting also plays a vital role in presenting the growth. Pdf reports are the qweb reports that are widely used in Odoo for printing invoices, sales, purchase orders, and quotations.
While users can have a question: is it possible only in A4? or can we print it in any other formats? In Odoo, we can print the report in different formats, widths, and heights. Odoo can set up the custom paper format for each report.
Here it illustrates the paper format
<record id="paperformat_student" model="report.paperformat">
<field name="name">Custom Paper</field>
<field name="default" eval="True" />
<field name="format">custom</field>
<field name="page_height">297</field>
<field name="page_width">210</field>
<field name="orientation">Portrait</field>
<field name="margin_top">10.00</field>
<field name="margin_bottom">10.00</field>
<field name="margin_left">7.0</field>
<field name="margin_right">7.0</field>
<field name="header_line" eval="False" />
<field name="header_spacing">35</field>
<field name="dpi">125</field>
</record>
The model report.paperformat is used to create paper format records.
We can create the record with an id of a unique name.
One of the mandatory fields in paper format is the name. Here, it is mentioned as Custom paper
<field name="name">Custom Paper</field>
Format
For each paper format, we can apply a predefined format (A0 to A9, B0 to B10, Legal, Letter, Tabloid) or custom, in default A4 format. Using this field format a pdf report is printed out.
<field name="format">custom</field>
Here, it used format as a custom which prints out a custom paper
Dpi
This field means dot per inch, it represents the amount of dots that can be positioned on a line.
<field name="dpi">125</field>
90 is normally set by default, Here it is set as 125
margin_top
This field illustrates the margin sizes in mm as in the top
Margin_bottom
<field name="margin_bottom">10.00</field>
This field margin sizes at bottom, for example here it is 10.00 mm
Margin_left,margin_right
This field illustrates the margin_left,margin_right in mm
<field name="margin_left">7.0</field>
<field name="margin_right">7.0</field>
Here it gives an example of margin_left,and margin_right as in mm
Page_height,page_width
<field name="page_height">297</field>
<field name="page_width">210</field>
This field illustrates page dimensions such as height and page width in mm
Orientation
Orientation is an important factor that helps for customized navigation of the report, its organization is handled by this field. It can be set up as either Landscape or portrait orientation
<field name="orientation">Portrait</field>
Header_line
<field name="header_line" eval="False"/>
This field helps to display the header line, It acts as boolean we can set up as either True or False
Header_spacing
This field gives header spacing in mm, it keeps a particular spacing between the reports
<field name="header_spacing">35</field>
It is specified as header_spacing as 35 mm.
The created paper format is seen under the menu Reporting > Paperformat
The created paper format is added along with the record of particular report ir.actiions.report
We can add its paper format with the field name paperformat_id and ref of the paper format created.
<record id="action_report_student" model="ir.actions.report">
<field name="name">Student Report</field>
<field name="model">school.student</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">school_management.report_student</field>
<field name="report_file">school_management.report_student</field>
<field name="binding_model_id" ref="account.model_account_move" />
<field name="paperformat_id" ref="school_management.paperformat_student" />
<field name="binding_type">report</field>
</record>
Like this, we can add the paper format to each report with the needed alignment, page size, orientation, and margin sizes.