Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
1588 Переглядів

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
4397
2
бер. 22
21255
1
бер. 23
4372
1
черв. 17
9663
1
черв. 19
5773