Skip to Content
Menu
This question has been flagged
1 Reply
896 Views

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.



Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 15
3753
2
Mar 22
20183
1
Mar 23
3482
1
Jun 17
9066
1
Jun 19
5151