Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
15035 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Not working at all, and I couldn't find a solution online, most of the similar questions ended up unanswered.

Hii Yenthe, I want to know what would be the best approach to change language direction (LTR or RTL) for specific pdf report.

For example: A user with Arabic language sees the pdf report in RTL format, but I want that user to see specific pdf report, lets say Invoice document in LTR format but as usual RTL for other pdf reports.

I am looking out for the solution so long.

Câu trả lời hay nhất

For Odoo 12 I copied the sale-order printing functionality sale_report_templates.xml

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
PDF reports Đã xử lý
5
thg 7 25
2360
Wrong PDF Format Đã xử lý
2
thg 3 24
2894
0
thg 11 22
3052
0
thg 9 17
5339
1
thg 7 17
4004