Custom Paper Format in Odoo 16
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.
Format
Odoo already has predefined formats (e.g., A0 to A9, B0 to B9), or we can define custom formats
<field name="format">custom</field>
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>
Orientation
We can define the orientation for our report. We can choose two orientations either landscape or portrait. Here we use Portrait for our report.
<field name="orientation">Portrait</field>
Header line
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" />
Header space
We can set header space, it is in mm
<field name="header_spacing">35</field> Request Your Free Quote
DPI
This image’s clarity and resolution are affected by the DPI setting. It is normally 90, but we are giving it 125 here.
<field name="dpi">125</field>
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.
DOWNLOAD ERP
"Unlock the Full Potential of Your Business with Odoo ERP!"
"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"
Get a Free Quote