From 29cd7154e66a30fb656b88e16b4301d17fa7d958 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 8 Mar 2017 16:43:44 +0100 Subject: [FIX] web: restore FieldStatus behavior FieldStatus was broken: - With a selection, the statusbar_visible attribute forces the choices to display, the discarded ones do not appear at all (even folded) - With a m2o, the fold_field option tells the field to check in the relation to know if the choice has to be folded or not, this was not properly supported - Changing a m2o value was broken as the parseMany2one function did not exist - The status were misordered - ... * Also refactor the way the rendering is handled. * Also modify all statusbar tests so that the statusbar widget is placed in the form header tag (as it is the common use case). --- addons/web/static/src/js/views/basic/basic_model.js | 9 +++++++-- 1 file changed, 7 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 cdb8bb61f7c..afac5c1c5ff 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -964,7 +964,7 @@ var BasicModel = AbstractModel.extend({ } var rel_data = _.pick(data, 'id', 'display_name'); var def; - if (!('display_name' in rel_data)) { + if (rel_data.display_name === undefined) { var field = record.fields[fieldName]; def = this._rpc(field.relation, 'name_get') .args([data.id]) @@ -1498,7 +1498,12 @@ var BasicModel = AbstractModel.extend({ _fetchSpecialStatus: function (record, fieldName) { var foldField = record.fieldAttrs[fieldName].options.fold_field; var fieldsToRead = foldField ? [foldField] : []; - return this._fetchSpecialMany2ones(record, fieldName, fieldsToRead); + return this._fetchSpecialMany2ones(record, fieldName, fieldsToRead).then(function (m2os) { + _.each(m2os, function (m2o) { + m2o.fold = foldField ? m2o[foldField] : false; + }); + return m2os; + }); }, /** * Fetch all data in a ungrouped list -- cgit v1.2.3