Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7153 มุมมอง

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>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 22
3899
5
เม.ย. 20
9390
QWeb format text and field in same line แก้ไขแล้ว
1
ธ.ค. 23
19004
Error in creating a custom paperformat แก้ไขแล้ว
1
ส.ค. 17
6771
3
เม.ย. 25
2218