From e968d1de7e65428e06704c52757678f069da7fcc Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 25 Oct 2018 16:51:36 +0000 Subject: [FIX] web: typo in docstring The parameter would not be correctly detected by doc extractors closes odoo/odoo#28169 --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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 116bd73fbdb..5ad8e92c907 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2007,7 +2007,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} resolves to the record or is rejected in -- cgit v1.2.3 From a219bdb85e9078f88bb5a7b43b3598762a7bd819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Mon, 22 Oct 2018 12:32:51 +0000 Subject: [FIX] web: consider correct viewtype when loading data Before this commit, when loading the data and calling the prostprocess, the viewType was not correctly passed which could lead to broken behaviour. For example, if one was to load a record from a list view embedded in a form view, the viewtype passed was the list which prevented to load the data from the form view. OPW 1891295 closes odoo/odoo#28279 --- addons/web/static/src/js/views/basic/basic_model.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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 5ad8e92c907..50f1f13808b 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -3573,11 +3573,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]) { @@ -3586,7 +3587,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]; -- cgit v1.2.3