Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Selecting the language of a PDF report

By
Rui Coelho
on 10/30/15, 11:25 AM 350 views

So, I have a PDF report that is available in several languages. How can I enable the user to select a specific language of the report in the "Print" button?

1

Yenthe

--Yenthe--
6716
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 10/30/15, 11:41 AM

Hi Rui,

The best thing that you can do is the same behaviour as with a quotation / sale order. The language of the report there is based on the language from the customer filled in on the quotation. When you create a many2one to the res.partner you know for which customer the report is. Thanks to this many2one you would know the language from the partner and from there on you can translate the report. Have a look at the default quotation / sale order report and handling languages:


<template id="report_saleorder">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
</t>   </t>
</template>

This bit of the code will get the language from the partner and will translate the report to the correct language. Do note: in order for this to work you also need to have translations in your .po files ofcourse!

Yenthe

Unfortunatelly that didn't work. When I retrieve the report it raises an exception: QWebException: 'NoneType' object has no attribute '_all_columns' I don't know if it's relevant but the report is on the product.product model.

Rui Coelho
on 10/30/15, 1:08 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/30/15, 11:25 AM
Seen: 350 times
Last updated: 10/30/15, 11:49 AM