[FIX] l10n_gcc_invoice: arabic invoice product name is displayed twice

Steps to reproduce:
-install l10n_sa_invoice module
-switch to a company in Saudi Arabia (SA company)
-create and print an invoice with a product that has arabic translation

Bug:
When adding a product and the Arabic translation.
If we add an internal reference it is added to the template,
Odoo directly concatenates this with the product name.
The result is the product name being duplicated.

Fix:
display line name and add the translation if it's different

opw-2829934

closes odoo/odoo#107798

X-original-commit: ad585bc41f49d047c150ceb9dc88bd9859fa046b
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Walid Hanniche (waha) <waha@odoo.com>
This commit is contained in:
Walid HANNICHE (waha)
2022-12-13 10:05:17 +01:00
parent a73cb1ca95
commit 96753cc371
@@ -274,17 +274,26 @@
<tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="line.display_type not in ('line_note', 'line_section')" name="account_invoice_line_accountable">
<td name="account_invoice_line_name">
<t t-set="translation_name" t-value="line.with_context(lang='ar_001').product_id.name"/>
<t t-if="line.product_id">
<span t-field="line.product_id.name" t-options="{'widget': 'text'}"/>
<t t-if="line.product_id.name != translation_name">
<t t-set="arabic_name" t-value="line.with_context(lang='ar_001').product_id.display_name"/>
<t t-set="english_name" t-value="line.with_context(lang='en_US').product_id.display_name"/>
<span t-field="line.product_id.display_name"
t-options="{'widget': 'text'}"/>
<t t-if="arabic_name != english_name">
<br/>
<span t-field="line.with_context(lang='ar_001').product_id.name"
t-options="{'widget': 'text'}"/>
style="text:right"
t-options="{'widget': 'text'}"/>
</t>
<t t-if="line.name != english_name and line.name != arabic_name">
<br/>
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</t>
</t>
<t t-if="line.name and line.name != line.product_id.name and line.name != translation_name">
<t t-if="line.product_id"><br/></t>
<t t-else="">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</t>
</td>