summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2013-03-21 17:11:23 +0100
committerChristophe Matthieu <chm@openerp.com>2013-03-21 17:11:23 +0100
commitcc4b2bbb2729077eea4dde9282eb696ce83188d4 (patch)
treef6b6fe8ecaf4070fa5ff3e562de98913a8a9aba7 /addons/web/static/src
parent4e43bccebcd414ee3c3aa436cea96926c22718cb (diff)
[IMP] view_form: fix FieldStatus
bzr revid: chm@openerp.com-20130321161123-j2qc2ynchneibf1o
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 28c31b80dd6..4f5d2e1cc47 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -5306,8 +5306,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
},
calc_domain: function() {
var d = instance.web.pyeval.eval('domain', this.build_domain());
- this.set("evaluated_selection_domain", ['&', ['fold', '=', false], '|', ['id', '=', this.get('value')]].concat(d));
- this.set("evaluated_selection_domain_folded", ['&', ['fold', '!=', false], '|', ['id', '=', this.get('value')]].concat(d));
+ this.set("evaluated_selection_domain", ['|', ['id', '=', this.get('value')]].concat(d));
},
/** Get the selection and render it
* selection: [[identifier, value_to_display], ...]
@@ -5321,19 +5320,16 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({
var calculation = _.bind(function() {
if (this.field.type == "many2one") {
- var ds_unfold = new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), this.get("evaluated_selection_domain"))
- .read_slice(['name'], {}).then(function (records) {
+ return new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), this.get("evaluated_selection_domain"))
+ .read_slice(['name', 'fold'], {}).then(function (records) {
_.each(records, function (record) {
- selection_unfolded.push([record.id, record.name]);
- });
- });
- var ds_fold = new instance.web.DataSetSearch(self, self.field.relation, self.build_context(), this.get("evaluated_selection_domain_folded"))
- .read_slice(['name'], {}).then(function (records) {
- _.each(records, function (record) {
- selection_folded.push([record.id, record.name]);
+ if (record.fold) {
+ selection_folded.push([record.id, record.name]);
+ } else {
+ selection_unfolded.push([record.id, record.name]);
+ }
});
});
- return $.when(ds_unfold, ds_fold);
} else {
// For field type selection filter values according to
// statusbar_visible attribute of the field. For example: