summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-01-23 14:51:11 +0100
committerChristophe Simonis <chs@odoo.com>2017-01-23 14:51:11 +0100
commitfded0065ae217ed3f3ccda24a230677e92a0e8d1 (patch)
treedff3b3970e89ab546b7fb64d74df0090d0ec8332 /addons/web/static/src/js/views
parentad766ba20db73ceb433b9afe3b5db3e52cf1494a (diff)
parent6c4389df41fb29f9707b205a8dcca13b3bf8a322 (diff)
[MERGE] forward port branch saas-14 up to 6c4389df41f
Diffstat (limited to 'addons/web/static/src/js/views')
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js6
-rw-r--r--addons/web/static/src/js/views/form_widgets.js23
-rw-r--r--addons/web/static/src/js/views/list_view.js18
3 files changed, 29 insertions, 18 deletions
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js
index b95b708aa05..fc3db6fd1ce 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -1062,8 +1062,10 @@ var One2ManyListView = X2ManyListView.extend({
this._dataset_changed = false;
});
- this.on('warning', this, function(e) { // In case of a one2many, we do not want any warning which comes from the editor
- e.stop_propagation();
+ this.on('warning', this, function(e) { // In case of editable list view, we do not want any warning which comes from the editor
+ if (this.editable()) {
+ e.stop_propagation();
+ }
});
},
do_add_record: function () {
diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js
index 7a13fc6d1f7..31e83d24777 100644
--- a/addons/web/static/src/js/views/form_widgets.js
+++ b/addons/web/static/src/js/views/form_widgets.js
@@ -447,9 +447,11 @@ var FieldDomain = common.AbstractField.extend(common.ReinitializeFieldMixin).ext
},
initialize_content: function () {
this._super.apply(this, arguments);
- this.$recordsCountDisplay = this.$(".o_domain_records_count");
- this.$showSelectionButton = this.$(".o_domain_show_selection_button");
- this.$errorMessage = this.$(".o_domain_error_message");
+ this.$panel = this.$(".o_form_field_domain_panel");
+ this.$showSelectionButton = this.$panel.find(".o_domain_show_selection_button");
+ this.$recordsCountDisplay = this.$showSelectionButton.find(".o_domain_records_count");
+ this.$errorMessage = this.$panel.find(".o_domain_error_message");
+ this.$modelMissing = this.$(".o_domain_model_missing");
},
set_value: function (value, noDomainSelectorRender) {
this._noDomainSelectorRender = !!noDomainSelectorRender;
@@ -459,6 +461,17 @@ var FieldDomain = common.AbstractField.extend(common.ReinitializeFieldMixin).ext
render_value: function() {
this._super.apply(this, arguments);
+ // If there is no set model, the field should only display the corresponding error message
+ this.$panel.toggleClass("o_hidden", !this.model);
+ this.$modelMissing.toggleClass("o_hidden", !!this.model);
+ if (!this.model) {
+ if (this.domainSelector) {
+ this.domainSelector.destroy();
+ this.domainSelector = undefined;
+ }
+ return;
+ }
+
var domain = pyeval.eval("domain", this.get("value") || "[]");
// Recreate domain widget with new domain value
@@ -496,14 +509,14 @@ var FieldDomain = common.AbstractField.extend(common.ReinitializeFieldMixin).ext
return new common.SelectCreateDialog(this, {
title: _t("Selected records"),
res_model: this.model,
- domain: this.get("value"),
+ domain: this.get("value") || "[]",
no_create: true,
readonly: true,
disable_multiple_selection: true,
}).open();
},
openDomainDialog: function () {
- new DomainSelectorDialog(this, this.model, this.get("value"), {
+ new DomainSelectorDialog(this, this.model, this.get("value") || "[]", {
readonly: this.get("effective_readonly"),
fs_filters: this.options.fs_filters,
debugMode: session.debug,
diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js
index 2468db8cbcf..572fcbff95f 100644
--- a/addons/web/static/src/js/views/list_view.js
+++ b/addons/web/static/src/js/views/list_view.js
@@ -1502,20 +1502,16 @@ ListView.Groups = Class.extend({
});
},
setup_resequence_rows: function (list, dataset) {
+ var sequence_field = _(this.columns).findWhere({'widget': 'handle'});
+ var seqname = sequence_field ? sequence_field.name : 'sequence';
+
// drag and drop enabled if list is not sorted (unless it is sorted by
- // sequence (ASC)), and there is a visible column with @widget=handle
- // or "sequence" column in the view.
- if ((dataset.sort && dataset.sort() && dataset.sort() !== 'sequence'
- && dataset.sort() !== 'sequence ASC')
- || !_(this.columns).any(function (column) {
- return column.widget === 'handle'
- || column.name === 'sequence'; })) {
+ // its sequence field (ASC)), and there is a visible column with
+ // @widget=handle or "sequence" column in the view.
+ if ((dataset.sort && [seqname, seqname + 'ASC', ''].indexOf(dataset.sort()) === -1)
+ || !_(this.columns).findWhere({'name': seqname})) {
return;
}
- var sequence_field = _(this.columns).find(function (c) {
- return c.widget === 'handle';
- });
- var seqname = sequence_field ? sequence_field.name : 'sequence';
// ondrop, move relevant record & fix sequences
list.$current.sortable({