diff options
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_model.js | 7 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_view.js | 8 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/kanban/kanban_controller.js | 2 |
3 files changed, 13 insertions, 4 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 de879018ad5..1e930ccf783 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2188,7 +2188,7 @@ var BasicModel = AbstractModel.extend({ * @param {Object} [options] * @param {string[]} [options.fieldNames] the list of fields to fetch. If * not given, fetch all the fields in record.fieldNames (+ display_name) - * @param {string} [optinos.viewType] the type of view for which the record + * @param {string} [options.viewType] the type of view for which the record * is fetched (usefull to load the adequate fields), by defaults, uses * record.viewType * @returns {Deferred<Object>} resolves to the record or is rejected in @@ -3785,11 +3785,12 @@ var BasicModel = AbstractModel.extend({ */ _postprocess: function (record, options) { var self = this; + var viewType = options && options.viewType || record.viewType; var defs = []; _.each(record.getFieldNames(options), function (name) { var field = record.fields[name]; - var fieldInfo = record.fieldsInfo[record.viewType][name] || {}; + var fieldInfo = record.fieldsInfo[viewType][name] || {}; var options = fieldInfo.options || {}; if (options.always_reload) { if (record.fields[name].type === 'many2one' && record.data[name]) { @@ -3798,7 +3799,7 @@ var BasicModel = AbstractModel.extend({ model: field.relation, method: 'name_get', args: [element.data.id], - context: self._getContext(record, {fieldName: name}), + context: self._getContext(record, {fieldName: name, viewType: viewType}), }) .then(function (result) { element.data.display_name = result[0][1]; diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index 9e1cde2aada..eb3efe7001d 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -150,6 +150,14 @@ var BasicView = AbstractView.extend({ } } } + // Many2one: context is not the same between the different views + // this means the result of a name_get could differ + if (fieldType === 'many2one') { + if (JSON.stringify(record.data[name].context) !== + JSON.stringify(fieldInfo.context)) { + fieldNames.push(name); + } + } } }); diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/js/views/kanban/kanban_controller.js index e195b33068c..6ffbad9612a 100644 --- a/addons/web/static/src/js/views/kanban/kanban_controller.js +++ b/addons/web/static/src/js/views/kanban/kanban_controller.js @@ -273,7 +273,7 @@ var KanbanController = BasicController.extend({ _onButtonNew: function () { var state = this.model.get(this.handle, {raw: true}); var quickCreateEnabled = this.quickCreateEnabled && viewUtils.isQuickCreateEnabled(state); - if (this.on_create === 'quick_create' && quickCreateEnabled) { + if (this.on_create === 'quick_create' && quickCreateEnabled && state.data.length) { // Activate the quick create in the first column this.renderer.addQuickCreate(); } else if (this.on_create && this.on_create !== 'quick_create') { |
