[FIX] website_sale: clean RTL mess with Comparison Price feature

Odoo 16 has new feature *Comparison Price*. It allows to show striked price
after the main price. E.g. `$555 -$666-`.

It doesn't work well however on using RTL languages because of *Unicode
Bidirectional Algorithm*. For example, in Egyptian localizations it shows some
mess of striked and not striked characters: `LE -LE-666- 555`. The correct
display should be `-LE-666- LE 555`. (Examples are even more complicated with
symbol E£ that is currently used by default for EGP).

As a solution, use `<bdi>` element to isolate stiked value. Also we have to use attribute
`dir="inherit"` to avoid changing direction for currencies that use LTR
characters, otherwise the result would be `-666-LE- LE 555`.

STEPS:

- Go to settings > website: Activate *Comparison Price*
- Go to Sales > Pricelist: add extra pricelists with EGP currency and mark it
as **Selectable**
- Go to Setting > Languages: activate the Arabic language and add it to the website.
- Go to the product form: add **Compare to Price**
- Go to the website > products, select pricelist EGP

opw-3188129
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/bdi

closes odoo/odoo#120102

X-original-commit: 26b2c5caa8c339ca6b341de317ae289b0d201b01
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
This commit is contained in:
Ivan Yelizariev
2023-04-28 16:04:46 +02:00
committed by Ivan Rasputin
parent e675a1e59f
commit 9c81dfc491
+4
View File
@@ -1163,12 +1163,14 @@
/>
<t t-if="is_view_active('website_sale.tax_indication')" t-call="website_sale.tax_indication"/>
<del t-if="combination_info['compare_list_price'] and (combination_info['compare_list_price'] &gt; combination_info['price'])">
<bdi dir="inherit">
<span t-esc="combination_info['compare_list_price']"
groups="website_sale.group_product_price_comparison"
t-options='{
"widget": "monetary",
"display_currency": website.currency_id,
}'/>
</bdi>
</del>
</h3>
<h3 class="css_non_editable_mode_hidden decimal_precision" t-att-data-precision="str(website.currency_id.decimal_places)">
@@ -1179,12 +1181,14 @@
}'/>
<t t-if="is_view_active('website_sale.tax_indication')" t-call="website_sale.tax_indication"/>
<del t-if="combination_info['compare_list_price'] and (combination_info['compare_list_price'] &gt; combination_info['price'])">
<bdi dir="inherit">
<span t-field="product.compare_list_price"
groups="website_sale.group_product_price_comparison"
t-options='{
"widget": "monetary",
"display_currency": website.currency_id,
}'/>
</bdi>
</del>
</h3>
</div>