From e8bbc5cd44dc25a89151323ee1be82a2c405a309 Mon Sep 17 00:00:00 2001 From: Bruno Boi Date: Tue, 12 Oct 2021 11:56:53 +0000 Subject: [PATCH] [FIX] web: pivot style in right-to-left MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Headers of columns and rows are not properly aligned on RTL direction. After this commit, they will be. closes odoo/odoo#78261 X-original-commit: 2fb992d3ced438fd012d7702bdfbe23cce6000a6 Related: odoo/enterprise#21645 Signed-off-by: Géry Debongnie (ged) --- .../static/src/views/pivot/pivot_renderer.js | 2 ++ .../static/src/views/pivot/pivot_renderer.xml | 18 ++++++++++++++++-- .../web/static/src/views/pivot/pivot_view.scss | 18 ++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/views/pivot/pivot_renderer.js b/addons/web/static/src/views/pivot/pivot_renderer.js index 28ac81e7565..9b80fe5d77b 100644 --- a/addons/web/static/src/views/pivot/pivot_renderer.js +++ b/addons/web/static/src/views/pivot/pivot_renderer.js @@ -1,6 +1,7 @@ /** @odoo-module **/ import { PivotGroupByMenu } from "@web/views/pivot/pivot_group_by_menu"; +import { localization } from "@web/core/l10n/localization"; import { registry } from "@web/core/registry"; import fieldUtils from "web.field_utils"; @@ -11,6 +12,7 @@ export class PivotRenderer extends Component { setup() { this.model = this.props.model; this.table = this.model.getTable(); + this.l10n = localization; } willUpdateProps() { this.table = this.model.getTable(); diff --git a/addons/web/static/src/views/pivot/pivot_renderer.xml b/addons/web/static/src/views/pivot/pivot_renderer.xml index 90b73059b83..95f357a4990 100644 --- a/addons/web/static/src/views/pivot/pivot_renderer.xml +++ b/addons/web/static/src/views/pivot/pivot_renderer.xml @@ -47,10 +47,24 @@ - + }" + t-attf-style="{{ + isXAxis + ? undefined + : l10n.direction === 'ltr' + ? 'padding-left: ' + getPadding(cell) + 'px;' + : 'padding-right: ' + getPadding(cell) + 'px;' + }}" + t-att-data-tooltip="cell.label" + t-attf-data-tooltip-position="{{ l10n.direction === 'ltr' ? 'right' : 'left' }}" + t-on-click.prevent="onHeaderClick(cell, isXAxis ? 'col' : 'row')" + >