summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-03-08 16:43:44 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit29cd7154e66a30fb656b88e16b4301d17fa7d958 (patch)
tree4f1adf4c812aa38a1a9029c4e13d0beac26b45ee /addons/web/static/src/js/views/basic/basic_model.js
parentb5b649e5b21d41279f12f0dbe6cfa53ca2c52580 (diff)
[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).
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js9
1 files changed, 7 insertions, 2 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 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