diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-09-05 18:52:27 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-09-05 18:52:27 +0200 |
| commit | f19e6ce561b80d291cc97bf928c4b84b48ec0f59 (patch) | |
| tree | 7c5419b940876244f95d055682bbe19429ff4747 /addons/web/static/src/js/views | |
| parent | 7700bd172f790858fb4cb9e64b90c9c77d9e5b0a (diff) | |
| parent | 213759b03e5466f119f52a557d7feefb9d477267 (diff) | |
[MERGE] forward port branch 11.0 up to 213759b03e5
Diffstat (limited to 'addons/web/static/src/js/views')
7 files changed, 34 insertions, 6 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index d327fec4839..fe428af5e5e 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2447,11 +2447,11 @@ var BasicModel = AbstractModel.extend({ } var def = $.Deferred(); - + var evalContext = this._getEvalContext(record); this._rpc({ model: domainModel, method: 'search_count', - args: [Domain.prototype.stringToArray(domainValue)], + args: [Domain.prototype.stringToArray(domainValue, evalContext)], context: context }) .then(_.identity, function (error, e) { diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/js/views/calendar/calendar_model.js index 63a35171a30..1f8c9423cac 100644 --- a/addons/web/static/src/js/views/calendar/calendar_model.js +++ b/addons/web/static/src/js/views/calendar/calendar_model.js @@ -405,6 +405,7 @@ return AbstractModel.extend({ dayNames: moment.weekdays(), dayNamesShort: moment.weekdaysShort(), firstDay: _t.database.parameters.week_start, + slotLabelFormat: _t.database.parameters.time_format.search("%H") != -1 ? 'H:mm': 'h(:mm)a', }; }, /** diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/js/views/calendar/calendar_renderer.js index a8d5d07ed0d..89be23c849b 100644 --- a/addons/web/static/src/js/views/calendar/calendar_renderer.js +++ b/addons/web/static/src/js/views/calendar/calendar_renderer.js @@ -388,7 +388,8 @@ return AbstractRenderer.extend({ if (!event.allDay) { var start = event.r_start || event.start; var end = event.r_end || event.end; - display_hour = start.format('HH:mm') + ' - ' + end.format('HH:mm'); + var timeFormat = _t.database.parameters.time_format.search("%H") != -1 ? 'HH:mm': 'h:mma'; + display_hour = start.format(timeFormat) + ' - ' + end.format(timeFormat); if (display_hour === '00:00 - 00:00') { display_hour = _t('All day'); } diff --git a/addons/web/static/src/js/views/kanban/kanban_model.js b/addons/web/static/src/js/views/kanban/kanban_model.js index 6c4ea1f133c..5d606324023 100644 --- a/addons/web/static/src/js/views/kanban/kanban_model.js +++ b/addons/web/static/src/js/views/kanban/kanban_model.js @@ -61,11 +61,15 @@ var KanbanModel = BasicModel.extend({ if (!groupByField || groupByField.type !== 'many2one') { return $.Deferred().reject(); // only supported when grouped on m2o } + // ignore action default which may be for another model + var context = _.pick(parent.context, function (value, key) { + return key.slice(0,8) !== 'default_'; + }); return this._rpc({ model: groupByField.relation, method: 'name_create', args: [name], - context: parent.context, // todo: combine with view context + context: context, // todo: combine with view context }) .then(function (result) { var newGroup = self._makeDataPoint({ @@ -272,6 +276,9 @@ var KanbanModel = BasicModel.extend({ options.groupBy = this.defaultGroupedBy; } var def = this._super(id, options); + if (options && options.loadMoreOffset) { + return def; + } return this._reloadProgressBarGroupFromRecord(id, def); }, /** diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index a72cd7008eb..2388b3a3707 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -193,7 +193,6 @@ var ListRenderer = BasicRenderer.extend({ reject = columnInvisibleFields[c.attrs.name]; } if (!reject && c.attrs.widget === 'handle') { - self.hasHandle = true; self.handleField = c.attrs.name; } return reject; @@ -659,6 +658,8 @@ var ListRenderer = BasicRenderer.extend({ this._computeAggregates(); $table.toggleClass('o_list_view_grouped', is_grouped); $table.toggleClass('o_list_view_ungrouped', !is_grouped); + this.hasHandle = this.state.orderedBy.length === 0 || + this.state.orderedBy[0].name === this.handleField; if (is_grouped) { $table .append(this._renderHeader(true)) 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 b5648d358a9..390ccfed6e1 100644 --- a/addons/web/static/src/js/views/pivot/pivot_renderer.js +++ b/addons/web/static/src/js/views/pivot/pivot_renderer.js @@ -14,6 +14,16 @@ var PivotRenderer = AbstractRenderer.extend({ 'hover td': '_onTdHover', }), + /** + * @override + * @param {Object} [params.widgets] mapping (fieldName -> widget) used to + * format the cells + */ + init: function (parent, state, params) { + this._super.apply(this, arguments); + this.fieldWidgets = params.widgets || {}; + }, + //-------------------------------------------------------------------------- // Private //-------------------------------------------------------------------------- @@ -141,7 +151,8 @@ var PivotRenderer = AbstractRenderer.extend({ if (value !== undefined) { name = this.state.measures[j % nbrMeasures]; measure = this.state.fields[name]; - value = field_utils.format[measureTypes[j % nbrMeasures]](value, measure); + var formatter = this.fieldWidgets[name] || measureTypes[j % nbrMeasures]; + value = field_utils.format[formatter](value, measure); } $cell = $('<td>') .data('id', rows[i].id) diff --git a/addons/web/static/src/js/views/pivot/pivot_view.js b/addons/web/static/src/js/views/pivot/pivot_view.js index e0b232b6310..aa12a3324a7 100644 --- a/addons/web/static/src/js/views/pivot/pivot_view.js +++ b/addons/web/static/src/js/views/pivot/pivot_view.js @@ -43,6 +43,7 @@ var PivotView = AbstractView.extend({ var measures = {}; var groupableFields = {}; + var widgets = {}; this.fields.__count = {string: _t("Count"), type: "integer"}; _.each(this.fields, function (field, name) { @@ -64,6 +65,10 @@ var PivotView = AbstractView.extend({ name += ':' + field.attrs.interval; } + if (field.attrs.widget) { + widgets[name] = field.attrs.widget; + } + // add active measures to the measure list. This is very rarely // necessary, but it can be useful if one is working with a // functional field non stored, but in a model with an overrided @@ -94,6 +99,8 @@ var PivotView = AbstractView.extend({ this.loadParams.rowGroupBys = rowGroupBys; this.loadParams.fields = this.fields; + this.rendererParams.widgets = widgets; + this.controllerParams.title = params.title || this.arch.attrs.string || _t("Untitled"); this.controllerParams.enableLinking = !this.arch.attrs.disable_linking; this.controllerParams.measures = measures; |
