コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6843 ビュー

Hey!

In Odoo 14.0, I would like to print a PDF of a qweb template for several models / docs but when I open my PDF, there is only one page with all my docs which are superimposed. I mean, all the content is there but on the same page and not One page for each doc.


datas = {'ids': product_ids}
res = self.env['product.template'].search([('id', 'in', product_ids)]).read(['name'])
res = res and res[0] or {}
res['template_code'] = code
res['date_start'] = date_start
res['date_end'] = date_end
res['pricelist'] = pricelist
datas['form'] = res
datas['active_model'] = 'product.template'

return self.env.ref(template).report_action(product_ids, data=datas)

This code is called when I press an action and I get a PDF back but as I said, I only get one page with all my products information overlapping each other (5 products names at the same place and so on...)

Do you know how can I print a custom report but with multiple pages?

<template id="my_id" name="my_name">
<t
t-call="web.basic_layout">
<t
t-foreach="docs" t-as="o">
<div
class="page">
               //Content of my template
</div>
</t>
</t>
</template>
アバター
破棄
最善の回答
I don't know if you got it right. It's because of web.basic_layout. Put it inside *<div class="page">*.

<template id="my_id" name="my_name">


<div class="page">
       
        <t t-call="web.basic_layout">

    <t t-foreach="docs" t-as="o">
    //Content of my template

    </t>
        </t>
</div>

アバター
破棄
関連投稿 返信 ビュー 活動
0
5月 22
3656
5
4月 20
9146
1
12月 23
18662
1
8月 17
6521
3
4月 25
1701