summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-06-21 15:16:54 +0200
committerChristophe Simonis <chs@odoo.com>2019-06-21 15:16:54 +0200
commit78b2063b29a321d152df9badb2d0324578ffe2ec (patch)
tree8ecfa4d4acec837795d84f75c39dc10ab98929d8 /addons/web/static/src
parente416428669fb18b59893b63f1d9769e871ac9321 (diff)
parent8747d72f1efbc3f32c41c20d4d3198410639d2aa (diff)
[MERGE] forward port branch saas-12.2 up to 8747d72f1ef
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/control_panel/search/add_new_favorite_menu.js28
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_controller.js1
-rw-r--r--addons/web/static/src/js/views/pivot/pivot_renderer.js2
-rw-r--r--addons/web/static/src/js/widgets/pie_chart.js7
-rw-r--r--addons/web/static/src/scss/pivot_view.scss5
-rw-r--r--addons/web/static/src/xml/base.xml2
6 files changed, 41 insertions, 4 deletions
diff --git a/addons/web/static/src/js/views/control_panel/search/add_new_favorite_menu.js b/addons/web/static/src/js/views/control_panel/search/add_new_favorite_menu.js
index 0a2498c69df..421fec3e04b 100644
--- a/addons/web/static/src/js/views/control_panel/search/add_new_favorite_menu.js
+++ b/addons/web/static/src/js/views/control_panel/search/add_new_favorite_menu.js
@@ -12,6 +12,7 @@ var AddNewFavoriteMenu = Widget.extend({
events: _.extend({}, Widget.prototype.events, {
'click .o_save_favorite': '_onSaveFavoriteClick',
'click .o_add_favorite.o_menu_header': '_onMenuHeaderClick',
+ 'click input[type="checkbox"]': '_onCheckboxClick',
'keyup .o_save_name input': '_onKeyUp',
}),
/**
@@ -108,6 +109,33 @@ var AddNewFavoriteMenu = Widget.extend({
//--------------------------------------------------------------------------
/**
+ * Additional behavior when a checkbox is clicked upon
+ * Namely, some checkbox are mutually exclusive
+ * this function allows this
+ *
+ * @private
+ * @param {jQueryEvent} ev
+ */
+ _onCheckboxClick: function (ev) {
+ function mutuallyExclusive (elem) {
+ if (!elem.id) return false;
+ return ['use_by_default', 'share_all_users'].some(function (str) {
+ return elem.id.indexOf(str);
+ });
+ }
+ var $checkboxes = this.$('input[type="checkbox"]');
+ var currentCheckBox = ev.target;
+
+ if (mutuallyExclusive(currentCheckBox)) {
+ for (var i=0; i < $checkboxes.length; i++) {
+ var checkbox = $checkboxes[i];
+ if (checkbox !== currentCheckBox && mutuallyExclusive(checkbox)) {
+ checkbox.checked = false;
+ }
+ }
+ }
+ },
+ /**
* @private
* @param {jQueryEvent} ev
*/
diff --git a/addons/web/static/src/js/views/pivot/pivot_controller.js b/addons/web/static/src/js/views/pivot/pivot_controller.js
index ac48ab769ff..fbc08e93b1e 100644
--- a/addons/web/static/src/js/views/pivot/pivot_controller.js
+++ b/addons/web/static/src/js/views/pivot/pivot_controller.js
@@ -53,7 +53,6 @@ var PivotController = AbstractController.extend({
* @override
*/
start: function () {
- this.$el.toggleClass('o_enable_linking', this.enableLinking);
this.$fieldSelection = this.$('.o_field_selection');
core.bus.on('click', this, function () {
this.$fieldSelection.empty();
diff --git a/addons/web/static/src/js/views/pivot/pivot_renderer.js b/addons/web/static/src/js/views/pivot/pivot_renderer.js
index 101f3734392..29c3424e141 100644
--- a/addons/web/static/src/js/views/pivot/pivot_renderer.js
+++ b/addons/web/static/src/js/views/pivot/pivot_renderer.js
@@ -283,7 +283,7 @@ var PivotRenderer = AbstractRenderer.extend({
$cell = $('<td>')
.data('id', rows[i].id)
.data('col_id', rows[i].col_ids[Math.floor(j / nbrMeasures)])
- .toggleClass('o_empty', !value)
+ .toggleClass('o_empty', _.isUndefined(value))
.addClass('o_pivot_cell_value text-right');
if (value !== undefined) {
$cell.append($('<div>', {class: 'o_value'}).html(formatter(value, measure)));
diff --git a/addons/web/static/src/js/widgets/pie_chart.js b/addons/web/static/src/js/widgets/pie_chart.js
index ddeca1fdcec..a9b0bc01e45 100644
--- a/addons/web/static/src/js/widgets/pie_chart.js
+++ b/addons/web/static/src/js/widgets/pie_chart.js
@@ -34,6 +34,11 @@ var PieChart = Widget.extend({
title: node.attrs.title || modifiers.title || modifiers.measure,
});
+ var pieChartContext = JSON.parse(JSON.stringify(record.context));
+ delete pieChartContext.graph_mode;
+ delete pieChartContext.graph_measure;
+ delete pieChartContext.graph_groupbys;
+
this.subViewParams = {
modelName: record.model,
withControlPanel: false,
@@ -41,7 +46,7 @@ var PieChart = Widget.extend({
mode: 'pie',
};
this.subViewParams.searchQuery = {
- context: record.context,
+ context: pieChartContext,
domain: domain,
groupBy: [],
};
diff --git a/addons/web/static/src/scss/pivot_view.scss b/addons/web/static/src/scss/pivot_view.scss
index 83f8fbc58e7..6bc25ee114e 100644
--- a/addons/web/static/src/scss/pivot_view.scss
+++ b/addons/web/static/src/scss/pivot_view.scss
@@ -87,4 +87,9 @@
right: 6px;
top: 9px;
}
+
+ .o_pivot_field_menu .dropdown-item.disabled {
+ color: $text-muted;
+ cursor: default;
+ }
}
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 564bbc8582e..c925809fab5 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -532,7 +532,7 @@
</div>
</div>
-<div t-name="PivotView" class="o_pivot">
+<div t-name="PivotView" t-attf-class="o_pivot #{widget.enableLinking ? 'o_enable_linking' : ''}">
<div class="o_field_selection"/>
</div>
<t t-name="PivotView.buttons">