콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
11 답글
22620 화면

I use odoo 11 latest version in windows.

My custom qweb template generate a good html, but the pdf does'nt work.

Default pdf reports work.

My code:

<?xml version="1.0" encoding="utf-8"?>

<odoo>

<template id="sale.sale_proposition">

<t t-set="o" t-value="doc.with_context({'lang':doc.partner_id.lang})" />

<div class="page">

<div class="oe_structure"/>

<div style="text-align:center;font-size:1.5em;font-weight:bold;font-style:italic">

<div class="row">

Proposition technique et commerciale<br />

N° <span t-field="o.name" /><br />

POUR

</div>

<div>

<img t-if="o.partner_id.image" t-att-src="'data:image/png;base64,%s' % o.partner_id.image.decode('ascii')" style="max-height: 100px;"/>

</div>

<div>

<span t-field="o.partner_id.name" /><br />

<t t-if="o.partner_id.street"><span t-field="o.partner_id.street" /><br /></t>

<t t-if="o.partner_id.street2"><span t-field="o.partner_id.street2" /><br /></t>

<span t-if="o.partner_id.zip" t-field="o.partner_id.zip" />

<span t-if="o.partner_id.city" t-field="o.partner_id.city" /><br t-if="o.partner_id.city or o.partner_id.city" />

</div>

<div t-if="o.partner_id.privilegedContactId">

À l'attention de

<span t-if="o.partner_id.privilegedContactId.title" t-field="o.partner_id.privilegedContactId.title" />

<span t-field="o.partner_id.privilegedContactId.name" />

</div>

<div>

Réalisée par

</div>

<div>

<img class="img img-responsive" src="/mymodule/static/img/coverpage.jpg"/>

</div>

</div>

<div class="oe_structure"/>

</div>

</template>

<template id="sale.report_proposition">

<t t-call="web.html_container">

<t t-foreach="docs" t-as="doc">

<t t-call="sale.sale_proposition" t-lang="doc.partner_id.lang"/>

</t>

</t>

</template>

<report

id="sale.action_report_proposition"

string="Proposition commerciale"

model="sale.order"

report_type="qweb-pdf"

file="sale.report_proposition"

name="sale.report_proposition"

print_report_name="'Proposition_commerciale_%s' % (object.name)"

/>

</odoo>


Here's what I get by opening the pdf with my text editor:



아바타
취소

Hello Benoît Fontaine,

Can you please check the version of wkhtmltopdf library which installed & responsible for the same.

Stable version of wkhtmltopdf is > wkhtmltopdf 0.12.2.1 (with patched qt).

Thanks

베스트 답변

You will need to change logon account for odoo service. It happens when odoo is unable to access the file generated, To avoid this issue set Odoo Service Logon Account to Administrator (Whoever has full control) instead of local service.

아바타
취소
베스트 답변

Hi Benoît Fontaine,

If like me, you don't want any formatting from Odoo then you can use

 <t t-call="web.basic_layout">

This worked for me. 

아바타
취소
작성자

Thanks ! It's work fine

베스트 답변

Please follow below step:

Download wkhtmltopdf patched with qt using below command

 - sudo wget -P Downloads https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

Here, replace "trusty" with your OS name and if 64 bit only then keep "amd64" like that , otherwise change it to "i386" and down load the deb file.

After that execute the following commands,

cd ~/Downloads

- sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

Now, check wkhtmltopdf version with below command,

- wkhtmltopdf -V

Hope above step help full.

Best Thanks,

Ankit H Gandhi.

아바타
취소
베스트 답변

Odoo v 11.0 & Windows 10 64bits

Replace <div class="page"> with <div class="article"> as Ahmad Khansaid before. It worked for me.



아바타
취소
베스트 답변

hey Hello Benoît Fontaine,
instead of this line <div class="page">, use <div class="article">

아바타
취소
작성자 베스트 답변

I had version 0.12.1.2

I just install 0.12.2.1:

C: \ Program Files (x86) \ Odoo 11.0> thirdparty \ wkhtmltopdf --version

wkhtmltopdf 0.12.2.1 (with qt patched)

But nothing changed

아바타
취소

I am having exactly the same issue in Odoo v11. My new custom report works in html but the pdf is generated blank.

Have you made any progress?

베스트 답변

Hello Benoît Fontaine,

You are missing <t t-call="web.external_layout"> in your report format.

wkhtmltopdf doesn't have any Issues here.

Also replied to your Github Issue in case  you are not getting mail from here.

아바타
취소
베스트 답변

Thanks Ahmad Khan - I had the same problem and your solution worked for me too ...

아바타
취소
관련 게시물 답글 화면 활동
3
4월 25
2266
5
9월 19
5789
0
1월 21
804
2
4월 20
10183
5
1월 25
27778