Skip to Content
Menu
This question has been flagged
2 Replies
593 Views

Hi Folks,

In Odoo 17, Is possible to Print two Different paper formats like A4 and 3inch. With the same Template Id?

Thanks

Rakesh 

Avatar
Discard
Best Answer

Hi,


In Odoo 17, it is not directly possible to print two different paper formats (like A4 and 3-inch receipt) using the same QWeb report template ID without additional customization. 

This is because each report in Odoo is tightly linked to a single paper format through its report definition in XML.


* Use the Same Template Logic, but Define Two Reports


You define two reports with different report_name and paperformat_id, but reuse the same report.template_id.


1- A4 report action


<record id="action_report_A4" model="ir.actions.report">
<field name="name">A4 report</field>
<field name="model">model.model</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">module.report_template_id</field>
<field name="report_file">module.report_template_id</field>
<field name="paperformat_id" ref="module.paperformat_a4_paper_format"/>
<field name="binding_type">report</field>
</record>

       

2-  3 inch report action


<record id="action_report_3_inch" model="ir.actions.report">
<field name="name">3 in report</field>
<field name="model">model.model</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">module.report_template_id</field>
<field name="report_file">module.report_template_id</field>
<field name="paperformat_id" ref="module.paperformat_3_inch_paper_format"/>
<field name="binding_type">report</field>
</record>


After adding the 2 report actions, from your model, you can call the actions based on the condition


 def print_report(self):

    if a4_condition:
return self.env.ref('module.action_report_A4').report_action(self, data=data)
else:
return self.env.ref('module.action_report_3_inch').report_action(self, data=data)



Hope it helps.

Avatar
Discard
Best Answer

Hello,

You can try https://apps.odoo.com/apps/modules/18.0/omni_print . With this module, you can choose a different paper size each time you print—unless you enable the 'Print Directly' option. See the screenshot below for reference.

Avatar
Discard
Related Posts Replies Views Activity
2
Feb 20
28941
1
Sep 15
7127
2
Jul 25
1461
1
Mar 25
1160
1
Mar 25
1010