[FIX] web: pivot no content helper

This commit reverts [1], which fixed the no content
helper message of the pivot view, by moving the message
definition in the JS.

With Owl components, one must always use the translation
function in the env (env._t), and no longer import it from
'web.core'. Moreover, there is no valid reason to define the
message in JS here, except that there was a bug in owl, that
has been fixed by [2] (merged in Odoo by the previous commit).

[1] https://github.com/odoo/odoo/commit/c7cc672aba669175280d619ad39b14daefd7733f
[2] https://github.com/odoo/owl/commit/2af8cccd65424ea75fbaa9f0a83c6974be4b1b5d

closes odoo/odoo#51442

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2020-05-18 12:44:45 +00:00
parent f71b09725f
commit 0a4ce899c5
2 changed files with 6 additions and 6 deletions
@@ -4,8 +4,6 @@ odoo.define('web.PivotRenderer', function (require) {
const OwlAbstractRenderer = require('web.AbstractRendererOwl');
const field_utils = require('web.field_utils');
const patchMixin = require('web.patchMixin');
const core = require('web.core');
const _t = core._t;
const { useExternalListener, useState, onMounted, onPatched } = owl.hooks;
@@ -52,9 +50,6 @@ odoo.define('web.PivotRenderer', function (require) {
if (!this.env.device.isMobile) {
useExternalListener(window, 'click', this._resetState);
}
if (!props.hasData || !props.measures.length) {
this.description = _t("Try to add some records, or make sure that there is at least one measure and no active filter in the search bar.");
}
}
//----------------------------------------------------------------------
+6 -1
View File
@@ -2,7 +2,12 @@
<templates>
<div t-name="web.PivotRenderer" class="o_pivot" owl="1">
<t t-if="!props.hasData || !props.measures.length" t-call="web.NoContentHelper"/>
<t t-if="!props.hasData || !props.measures.length">
<t t-set="description">
Try to add some records, or make sure that there is at least one measure and no active filter in the search bar
</t>
<t t-call="web.NoContentHelper"/>
</t>
<table t-else="1" class="table-hover table-sm table-bordered" t-att-class="{ o_enable_linking: !props.disableLinking }">
<thead>
<tr t-foreach="props.table.headers" t-as="row" t-key="'header_' + row_index">