[FIX] account, web : display monetary and numbers in rtl language

Issue:
======
- Display of monetary values in kanban views is wrong in rtl language
- Pivot display has multiple erros in rtl language: values are left
  aligned and they are supposed to be right aligned like in ltr lang,
  negative numbers has the sign in the wrong place, the (plus/minus)
  icon placement is wrong (it should be before the title and not after)

Steps to reproduce the error:
=============================
- Install accounting and rlt language (arabic for example)
- Go to accounting (display of monetary fields is wrong)
- Go to accounting/accounting/journal items/pivot view
- Choose residual amount in view (it has some negative values)

Solution:
=========
Kanban Solution:
- I fixed the direction of the display to be ltr always for monetary
  values and added the class to the appropriate tags.
Pivot Solution:
- I fixed the direction and text-align style for the values to always
  display the same like rtl.
- displaying the icon and then the title will always give the desired
  display since the direction will reverse their order itself when it's
  rtl

enterprise fix : https://github.com/odoo/enterprise/pull/46675

opw-3295573

closes odoo/odoo#134296

X-original-commit: 6b7f89b43b6abc970c955760da203a1e41c53652
Related: odoo/enterprise#46900
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
Signed-off-by: Mahdi Cheikh Rouhou (macr) <macr@odoo.com>
This commit is contained in:
Mahdi Cheikh Rouhou (macr)
2023-09-07 10:29:43 +00:00
committed by Mahdi cheikh rouhou (macr)
parent 04eed39aa8
commit 9e8b8d1bf7
4 changed files with 25 additions and 10 deletions
@@ -230,7 +230,7 @@
<a type="object" name="open_action" context="{'action_name': 'action_move_journal_line', 'search_default_to_check': True}"><t t-out="dashboard.number_to_check"/> to check</a>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.to_check_balance"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.to_check_balance"/></span>
</div>
</div>
</t>
@@ -266,7 +266,7 @@
<span>Balance</span>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.account_balance"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.account_balance"/></span>
</div>
</div>
<t t-if="dashboard.has_at_least_one_statement and dashboard.account_balance != dashboard.last_balance">
@@ -275,7 +275,7 @@
<span title="Latest Statement">Last Statement</span>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.last_balance"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.last_balance"/></span>
</div>
</div>
</t>
@@ -325,7 +325,7 @@
</a>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.sum_draft"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.sum_draft"/></span>
</div>
</div>
<div class="row" t-if="dashboard.number_waiting">
@@ -341,7 +341,7 @@
</a>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.sum_waiting"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.sum_waiting"/></span>
</div>
</div>
<div class="row" t-if="dashboard.number_late">
@@ -352,7 +352,7 @@
</a>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.sum_late"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.sum_late"/></span>
</div>
</div>
<t t-if="dashboard.number_to_check > 0">
@@ -361,7 +361,7 @@
<a type="object" name="open_action" context="{'search_default_to_check': True}"><t t-out="dashboard.number_to_check"/> to check</a>
</div>
<div class="col-auto text-end">
<span><t t-out="dashboard.to_check_balance"/></span>
<span class="o_kanban_monetary"><t t-out="dashboard.to_check_balance"/></span>
</div>
</div>
</t>
@@ -654,6 +654,15 @@
width: $o-kanban-color-border-width;
z-index: 1; // show the title over kanban color
}
.o_field_monetary, .o_kanban_monetary {
/*rtl:ignore*/
direction: ltr;
}
span.o_kanban_monetary {
display: inline-block;
}
}
.o_kanban_mobile .o_kanban_renderer .o_kanban_record {
@@ -28,7 +28,7 @@
<t t-set="cell" t-value="row"/>
</t>
<t t-foreach="row.subGroupMeasurements" t-as="cell" t-key="'row_cell_' + cell_index">
<td class="o_pivot_cell_value text-end bg-100" t-att-class="{
<td class="o_pivot_cell_value bg-100" t-att-class="{
o_empty: cell.value === undefined,
'cursor-pointer': cell.value !== undefined,
'fw-bold': cell.isBold,
@@ -84,9 +84,8 @@
onAddCustomGroupBy="fieldName => this.onAddCustomGroupBy(isXAxis ? 'col' : 'row', cell.groupId, fieldName)"
/>
</t>
<span t-if="l10n.direction === 'rtl'" t-esc="cell.title"/>
<i t-attf-class="fa fa-{{ cell.isLeaf ? 'plus-square' : 'minus-square-o' }} me-1"/>
<span t-if="l10n.direction === 'ltr'" t-esc="cell.title"/>
<span t-esc="cell.title"/>
</th>
</t>
@@ -22,6 +22,13 @@
.o_pivot_cell_value.o_cell_hover {
background-color: $table-hover-bg;
}
.o_pivot_cell_value {
/*rtl:ignore*/
text-align: right !important;
/*rtl:ignore*/
direction: ltr;
}
}
.o_pivot_view {