Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1480 Widoki

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.



Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lis 15
4278
2
mar 22
21020
1
mar 23
4217
1
cze 17
9587
1
cze 19
5675