Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
6596 มุมมอง

I'm trying to create two versions for reports, the view is exactly the same for both versions, but the orientation is different, one report is intended to be printed on A4  Portrait and the other on A4- Lanscape.

The problem is that Odoo always print both reports with the same paper size.

อวตาร
ละทิ้ง
ผู้เขียน

Please anyone body provide me an idea to resolve this case

คำตอบที่ดีที่สุด

hi everybody,

i'm encountring some issue with odoo 12 community  with paper format declaration: report are well generated and linked to the good paper format (verified on technical settings > reports ) but the output pdf is always A4 format.

it seems like the output is somewhere forced to A4.

if any one could help, it ld be graceful.


thanks in advance

อวตาร
ละทิ้ง

hello,

thanks for your hel, it was very helpful.

are you odoo developer ? have you any whatsapp number ?

regards


On 10/11/2020 11:00, Niyas Raphy wrote:
คำตอบที่ดีที่สุด

Hi,

Please see this method of printing the reports in landscape mode from python code and see whether it helps: How To Print PDF Report In Landscape Mode From Code in Odoo

Sample:

def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update({'sort_selection': self.sort_selection})
return self.env.ref('account.action_report_journal').with_context(landscape=True).report_action(self, data=data)

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Kitty,

You need to define separate paper format for both report and used in paperformat_id of report record

Foe Example :-

Potrait :-
<record id="paper_format_potrait" model="report.paperformat">
    <field name="name">A4 - Potrait</field>
    <field name="format">A4-P</field>
    <field name="orientation">Portrait</field>
    <field name="margin_top">45</field>
    <field name="margin_bottom">25</field>
    <field name="margin_left">7</field>
    <field name="margin_right">7</field>
    <field name="header_spacing">34</field>
    <field name="dpi">90</field>
</record>

<report
    string="report_menu_name"
    id="unique_id_for_report"
    model="model.name"
    report_type="qweb-pdf"
    name="module_name.report_template_id"
    file="module_name.report_template_id"/>

<record id="module_name.report_configuration_id" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="module_name.paper_format_potrait"/>
</record>

Landscape :-
<record id="paper_format_landscape" model="report.paperformat">
    <field name="name">A4 - Landscape</field>
    <field name="format">A4-L</field>
    <field name="orientation">Landscape</field>
    <field name="margin_top">7</field>
    <field name="margin_bottom">7</field>
    <field name="margin_left">7</field>
    <field name="margin_right">7</field>
    <field name="header_spacing">10</field>
    <field name="dpi">90</field>
</record>

<report
    string="report_menu_name"
    id="unique_id_for_report"
    model="model.name"
    report_type="qweb-pdf"
    name="module_name.report_template_id"
    file="module_name.report_template_id"/>

<record id="module_name.report_configuration_id" model="ir.actions.report.xml">
    <field name="paperformat_id" ref="module_name.paper_format_landscape"/>
</record>


Hope it will helps you.
Thanks,

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Header and footer missing in qweb report แก้ไขแล้ว
3
ส.ค. 19
9109
1
ม.ค. 24
5051
report template is not translating แก้ไขแล้ว
1
ส.ค. 19
15110
0
ม.ค. 24
1557