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

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>
Avatar
Discard
Best Answer
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>

Avatar
Discard
Related Posts Replies Views Activity
0
May 22
2643
5
Apr 20
8382
1
Dec 23
17502
1
Aug 17
5522
3
Dec 24
5727