From 20222bd5f401c1610e86b4960e340ccc751d8df3 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Wed, 4 Feb 2015 17:26:22 +0100 Subject: [IMP] doc: update report doc to include t-lang attribute in template translation --- doc/reference/reports.rst | 55 ++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'doc/reference') diff --git a/doc/reference/reports.rst b/doc/reference/reports.rst index 6f33100aedd..3440c90d64b 100644 --- a/doc/reference/reports.rst +++ b/doc/reference/reports.rst @@ -117,14 +117,6 @@ There are some specific variables accessible in reports, mainly: model for the ``docs`` records ``time`` a reference to :mod:`python:time` from the Python standard library -``translate_doc`` - a function to translate a part of a report. It must be used as follow: - - :: - - - - ``user`` ``res.user`` record for the user printing the report ``res_company`` @@ -142,33 +134,39 @@ you need to define two templates: * The main report template * The translatable document -You can then call translate_doc from your main template to obtain the -translated document. If you wish to see the details of the translation in the -backend, you can go to :menuselection:`Settings --> Reports --> Report --> - --> Search associated QWeb views --> --> -Associated translations`. +You can then call the translatable document from your main template with the attribute +``t-lang`` set to a language code (for example ``fr`` or ``en_US``) or to a record field. +You will also need to re-browse the related records with the proper context if you use +fields that are translatable (like country names, sales conditions, etc.) + +.. warning:: + + If your report template does not use translatable record fields, re-browsing the record + in another language is *not* necessary and will impact performances. For example, let's look at the Sale Order report from the Sale module:: -