[FIX] sale_coupon: print report in customer lang

Before this commit, coupons were printed using the connected user language
instead of the customer language.

opw-1970448

closes odoo/enterprise#4142

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>

X-port/Cherry-pick of odoo/enterprise@5a4ce5a3bc
This commit is contained in:
Julien Castiaux
2019-05-06 15:18:28 +02:00
committed by Christophe Simonis
parent 406b2850b5
commit 2b080256dd
2 changed files with 10 additions and 5 deletions
@@ -4,8 +4,8 @@
<report
id="report_coupon_code"
model="sale.coupon"
name="sale_coupon.report_coupon"
file="sale_coupon.report_coupon"
name="sale_coupon.report_coupon_i18n"
file="sale_coupon.report_coupon_i18n"
report_type="qweb-pdf"
string="Coupon Code"/>
</data>
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_coupon">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">
<div class="card">
<div class="card-body">
@@ -68,7 +66,14 @@
</div>
</div>
</div>
</t>
</t>
</template>
<template id="report_coupon_i18n">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)"/>
<t t-call="sale_coupon.report_coupon" t-lang="o.partner_id.lang"/>
</t>
</t>
</template>