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

Hello, I did a qweb report with 2 foreach on different records/models. On first foreach I t-calls a template. On the second foreach I t-call a second template. In this way I was able to merge 2 differents reports.

Everything is working fine but now I need to print the first template in portrait mode and the second template in landscape mode.
Is there a way to achieve this?

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

To define two different paper formats for a report in Odoo, you can override the get_report_paperformat method in your custom report template. Here's an example of how you can achieve this:

from odoo import models

class CustomReport(models.AbstractModel):
_name = 'report.custom_module.custom_report_template'

def get_report_paperformat(self, docids, data=None):
if condition: # Define your condition to determine the paper format
return self.env.ref('report.paperformat_custom_format').sudo()
else:
return self.env.ref('report.paperformat_custom_format2').sudo()

In this example, we have a custom report template defined in the module custom_module with the report XML ID custom_report_template. We override the get_report_paperformat method to dynamically select the appropriate paper format based on a condition.
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

the page orientation 

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

Hi,

In Odoo's QWeb reports, the page orientation (portrait or landscape) is typically set at the report level and applies to the entire report. However, you can achieve different page orientations for different sections within the report by creating separate report templates for each section.

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Error in creating a custom paperformat แก้ไขแล้ว
1
ส.ค. 17
6967
1
เม.ย. 25
1447
2
มี.ค. 25
1748
4
พ.ย. 24
7368
1
มี.ค. 24
2249