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

Hi all,

I am facing a issue to print the stock picking with two format 

landscape for destination customers

portrait for destination internal 

the goal is not to have many report action as format ! 

how can we do maybe with a t-call but how ? 

i putted a condition before the t-call to disguish what template use.

Best regards.



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

Hi,

1. Create report action:
<report
    id="report_stock_picking"
    string="Stock Picking Report"
    model="stock.picking"
    report_type="qweb-pdf"
name="your_module.report_stock_picking"
file="your_module.report_stock_picking"
    attachment_use="False"
/>


2. Define Report Template:

<?xml version="1.0"?>
<template id="report_stock_picking">
    <!-- Dynamically select template based on destination -->
<t t-if="o.partner_id.is_customer">
<t t-call="your_module.report_stock_picking_landscape"/>
    </t>
    <t t-else="">
<t t-call="your_module.report_stock_picking_portrait"/>
    </t>
</template>

<template id="report_stock_picking_landscape">
    <!-- Define landscape template -->
<t t-call="report.external_layout">
        <t t-foreach="docs" t-as="o">
            <!-- Landscape content goes here -->
        </t>
    </t>
</template>

<template id="report_stock_picking_portrait">
    <!-- Define portrait template -->
<t t-call="report.external_layout">
        <t t-foreach="docs" t-as="o">
            <!-- Portrait content goes here -->
        </t>
    </t>
</template>


Hope it helps

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ย. 15
3743
2
มี.ค. 22
20169
1
มี.ค. 23
3456
1
มิ.ย. 17
9050
1
มิ.ย. 19
5146