[FIX] web: CharDomain form widget: fixed change selection
button not correctly displayed depending on the effective_readonly parameter. It is now correctly computed. Also added a link to see records when in view mode, instead of not being able to see the selection if not in edit mode.
This commit is contained in:
parent
a574f83b0b
commit
6389181e8f
|
@ -2525,14 +2525,10 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.on("change:effective_readonly", this, function () {
|
this.on("change:effective_readonly", this, function () {
|
||||||
this.display_field();
|
this.display_field();
|
||||||
this.render_value();
|
|
||||||
});
|
});
|
||||||
this.display_field();
|
this.display_field();
|
||||||
return this._super();
|
return this._super();
|
||||||
},
|
},
|
||||||
render_value: function() {
|
|
||||||
this.$('button.select_records').css('visibility', this.get('effective_readonly') ? 'hidden': '');
|
|
||||||
},
|
|
||||||
set_value: function(value_) {
|
set_value: function(value_) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.set('value', value_ || false);
|
this.set('value', value_ || false);
|
||||||
|
@ -2547,7 +2543,12 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
|
||||||
var ds = new instance.web.DataSetStatic(self, model, self.build_context());
|
var ds = new instance.web.DataSetStatic(self, model, self.build_context());
|
||||||
ds.call('search_count', [domain]).then(function (results) {
|
ds.call('search_count', [domain]).then(function (results) {
|
||||||
$('.oe_domain_count', self.$el).text(results + ' records selected');
|
$('.oe_domain_count', self.$el).text(results + ' records selected');
|
||||||
$('button span', self.$el).text(' Change selection');
|
if (self.get('effective_readonly')) {
|
||||||
|
$('button span', self.$el).text(' See selection');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('button span', self.$el).text(' Change selection');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('.oe_domain_count', this.$el).text('0 record selected');
|
$('.oe_domain_count', this.$el).text('0 record selected');
|
||||||
|
@ -2561,8 +2562,12 @@ instance.web.form.FieldCharDomain = instance.web.form.AbstractField.extend(insta
|
||||||
var model = this.options.model || this.field_manager.get_field_value(this.options.model_field);
|
var model = this.options.model || this.field_manager.get_field_value(this.options.model_field);
|
||||||
this.pop = new instance.web.form.SelectCreatePopup(this);
|
this.pop = new instance.web.form.SelectCreatePopup(this);
|
||||||
this.pop.select_element(
|
this.pop.select_element(
|
||||||
model, {title: 'Select records...'},
|
model, {
|
||||||
[], this.build_context());
|
title: this.get('effective_readonly') ? 'Selected records' : 'Select records...',
|
||||||
|
readonly: this.get('effective_readonly'),
|
||||||
|
disable_multiple_selection: this.get('effective_readonly'),
|
||||||
|
no_create: this.get('effective_readonly'),
|
||||||
|
}, [], this.build_context());
|
||||||
this.pop.on("elements_selected", self, function(element_ids) {
|
this.pop.on("elements_selected", self, function(element_ids) {
|
||||||
if (this.pop.$('input.oe_list_record_selector').prop('checked')) {
|
if (this.pop.$('input.oe_list_record_selector').prop('checked')) {
|
||||||
var search_data = this.pop.searchview.build_search_data();
|
var search_data = this.pop.searchview.build_search_data();
|
||||||
|
|
Loading…
Reference in New Issue