Reports are used to monitor the growth of every organization. In presenting the reports, Odoo plays an important role. To print reports for sales, purchases, inventory, invoices…etc Odoo mainly uses qweb report(PDF report).In Odoo, Depending on our convenience, we can define the paper format for our report. Reports can be printed in different formats, widths, and heights in Odoo.
Here is an example code for creating a custom paper format so that we can tailor our report
The model report. Paper format is used to create the paper format.
We need to give a Unique id for the paper format, and the name is also mandatory.
Odoo already has predefined formats (e.g., A0 to A9, B0 to B9), or we can define custom formats
Here we give custom for our report
Page Height and Page Width
We can set our page height and page width for our report. where width and height are in millimeters
<field name="page_height">297</field> <field name="page_width">210</field>
Margin top, Margin bottom, Margin left, and Margin right
These four define margin dimensions in millimeters
<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>
We can define the orientation for our report. We can choose two orientations either landscape or portrait. Here we use Portrait for our report.
Setting up headlines will be easier with this Since it is a Boolean field, we can only pass True or False values.
<field name="header_line" eval="False" />
We can set header space, it is in mm
<field name="header_spacing">35</field> Request Your Free Quote
This image’s clarity and resolution are affected by the DPI setting. It is normally 90, but we are giving it 125 here.
After creating, this we can install or update our module. So that we can view our custom paper format in Odoo by
Go to Settings -> Technical -> Reporting -> Paper format
Then you can see your paper format.
So, we can call this custom paper format in the report. We can add the paper format to each report with the alignment, page size, orientation, and margins.