Reputation: 721
I am creating the report which can be translated to current user language. so I tried the following code. Report is working but the language to translate is always the partner_id
of model (stock.picking
), But I want the report to be translated to current logged user lang.
report translation is as below:
<template id="report_print_recvng_wkst">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'wms_report.report_recvngwkst_document')"/>
</t>
</t>
</template>
I also tried putting user.lang
, lang
or env.user.lang
, but I get the error that stock.picking do not have user.lang etc.
Also, is there a way to debug in xml file, I mean how can I see the env object in report
Upvotes: 2
Views: 4028
Reputation: 14746
Default behavior is that, in report partner language is set, report is generated in partner's language (partner which is set there in record).
And if you want to update that scenario then you need to do such other thing like partner_id.lang
should be replaced by request.env.user.partner_id.lang
<template id="report_print_recvng_wkst">
<t t-call="report.html_container">
<t t-foreach="doc_ids" t-as="doc_id">
<t t-raw="translate_doc(doc_id, doc_model, 'request.env.user.partner_id.lang', 'wms_report.report_recvngwkst_document')"/>
</t>
</t>
</template>
Upvotes: 1