[FIX] l10n_gcc_invoice: language context lost in template rendering

Reproduction:
1. Install Accounting, l10n_sa
2. Create/Switch to a company located in Saudi Arabia
3. Go to Accounting -> Customer Invoice, and create a new invoice with a
customer with language preference set to Arabic
4. Choose any product, and set the Payment terms as Immediate Payment
5. Confirm the invoice and print it, the payment term on the left end of
the invoice is in Arabic, which should be in English

Reason: in Odoo 16, the rendering of “t-field” loses the provided
context because the values are rendered with the env context instead.
The change is introduced by https://github.com/odoo/odoo/commit/880954ebfc1106411b7f7a7d60aee05dfae60893
here: https://github.com/odoo/odoo/blob/810a1d29bfa7c497627a37e0cec64df51b75bb4b/odoo/addons/base/models/ir_qweb_fields.py#L120

Fix: Using “t-out” instead of “t-field” for html fields in the template
to keep the forced context of en-US. Similar fixes are done for other
html fields in this template, e.g. fiscal_position_id.note, narration.
These fields’ types were changed from Char to Html here: https://github.com/odoo-dev/odoo/commit/23483865b1508346f5a5e178f4a436fe1a9d9f55

Related commit:
Change in ir_qweb_fields.py : https://github.com/odoo/odoo/commit/880954ebfc1106411b7f7a7d60aee05dfae60893
Change of field type: https://github.com/odoo-dev/odoo/commit/23483865b1508346f5a5e178f4a436fe1a9d9f55

opw-3085284

closes odoo/odoo#109083

X-original-commit: 3351aa4b36b3d2e6f42ec9acd1b11121d0cfedc0
Signed-off-by: Liu Jinjiu (jili) <jili@odoo.com>
This commit is contained in:
Jinjiu Liu
2023-01-04 17:50:50 +01:00
parent 1695850504
commit cf0a878e69
@@ -449,10 +449,10 @@
<p t-if="o.invoice_payment_term_id" name="payment_term">
<div class="row">
<div class="col-6 text-start">
<span t-field="o.invoice_payment_term_id.note"/>
<span t-out="o.invoice_payment_term_id.note"/>
</div>
<div class="col-6 text-end">
<span dir="rtl" t-field="o_sec.invoice_payment_term_id.note"/>
<span dir="rtl" t-out="o_sec.invoice_payment_term_id.note"/>
</div>
</div>
@@ -460,20 +460,20 @@
<p t-if="o.narration" name="comment">
<div class="row">
<div class="col-6 text-start">
<span t-field="o.narration"/>
<span t-out="o.narration"/>
</div>
<div class="col-6 text-end">
<span t-field="o_sec.narration"/>
<span t-out="o_sec.narration"/>
</div>
</div>
</p>
<p t-if="o.fiscal_position_id.note" name="note">
<div class="row">
<div class="col-6 text-start">
<span t-field="o.fiscal_position_id.note"/>
<span t-out="o.fiscal_position_id.note"/>
</div>
<div class="col-6 text-end">
<span t-field="o_sec.fiscal_position_id.note"/>
<span t-out="o_sec.fiscal_position_id.note"/>
</div>
</div>
</p>