Make a Qweb report translatable in Odoo v9

I wrote a tip how to make report translatable in Odoo v8 before, but in the newest version of Odoo, this functionality has been changed. It is introduced new attribute t-lang that as a value receives language abbreviation (en_US, de). Now instead of calling the method translate_doc you need to specify the name of the translatable report in the attribute t-call and the language in the attribute t-lang. All this in code looks like:

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

Where sale_order_report is the translatable report and sale_order_report_main is the main one.
You can find more about QWeb reports in Odoo v9 at the official documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *