Enable Dark Mode!
how-to-add-custom-paper-format-in-odoo-16-erp.jpg
By: Sahla Sherin

How to Add Custom Paper Format in Odoo 16 ERP?

Technical Odoo 16

Every organization's growth is monitored using a report. Odoo plays a vital role in presenting the reports. The qweb report (PDF report) is the widely used report in Odoo for printing reports like sales, invoices, purchases, etc.

In Odoo, we can customize the reporting printing format, height, width, etc. 

Here it demonstrates how to customize the report.

<record id="paperformat_gym_report"  model="report.paperformat">
<field name="name">Gym Report 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>

Here, the model report.paperformat is the model used to create the paper format.

We can create a paper format with a unique ID; the name field is also mandatory.

<field name="name">Gym Report Paper</field>

Now we define the name for the paper format here.

Format

We can also define the required format. In Odoo, there already exist the predefined format (eg:- A0 to A9, B0 to B9 ), or we can define the custom.

<field name="format">custom</field>

Here we give custom for printing our custom report.

Dpi

The DPI setting determines the number of dots per inch in this image, which affects its clarity and resolution. Normally it is 90, but here we give it as 125

<field name="dpi">125</field>

Margin_top, Margin_buttom, Margin_left, and Margin_right

These fields define the margin size in mm 

Margin_top:- Define the margin-top size

<field name="margin_top">10.00</field>

Margin_buttom:- Define the margin button size

<field name="margin_buttom">10.00</field>

Margin_left:- Define the margin-left size.

<field name="margin_left">7.0</field>

Margin_right:- Define the margin right size.

<field name="margin_right">7.0</field>

Orientation

We can define the orientation of the report. It is the most important factor used in the report. Ethier, we can choose landscape or portrait.

<field name="orientation">Portrait</field>

Header_line 

This will helps to setup headline. It is a boolean field, so we can only pass True or False values.

<field name="header_line" eval="False"/>

Header_spacing

This field help to get the header space. It is defined in mm.

<field name="header_spacing">35</field>

After installing or upgrading our custom module. Then our custom paper format is now available in our Odoo.

Go To Settings -> Technical -> Reporting -> Paperformat

There you can see the custom paper format 

how-to-add-custom-paper-format-in-odoo-16-erp-1-cybrosys

Now we can use this paperformat_id in the reporting

<record id="action_report_gym" model="ir.actions.report">
       <field name="name">Gym Report</field>
       <field name="model">gym.managment</field>
       <field name="report_type">qweb-pdf</field>
       <field name="report_name">gym_management.report_workout_report</field>
       <field name="report_file">gym_management.report_workout_report</field>
       <field name="binding_model_id" ref="account.model_account_move" />
       <field name="paperformat_id" ref="gym_mangement.paperformat_gym_report" />
       <field name="binding_type">report</field>
   </record>

There is another field named Associated Reports. It is an One2many field that shows report which is linked with this paper format.

In Odoo 16, there is a new boolean field available that is Disable smart shrinking; we can enable that from the front or we can do that from the backend also. This field is for avoiding the shrinking of the report

how-to-add-custom-paper-format-in-odoo-16-erp-2-cybrosys

<field name="disable_shrinking" eval="True" />

Enabling the Disable smart shrinking

how-to-add-custom-paper-format-in-odoo-16-erp-3-cybrosys

Disable the Disable smart shrinking 

how-to-add-custom-paper-format-in-odoo-16-erp-4-cybrosys

Like this, we can customize the paper format by altering the size, alignment, and header, etc.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message