summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/chrome/control_panel.js14
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js12
2 files changed, 22 insertions, 4 deletions
diff --git a/addons/web/static/src/js/chrome/control_panel.js b/addons/web/static/src/js/chrome/control_panel.js
index 4104f37bd3e..0913b574a3d 100644
--- a/addons/web/static/src/js/chrome/control_panel.js
+++ b/addons/web/static/src/js/chrome/control_panel.js
@@ -148,15 +148,25 @@ var ControlPanel = Widget.extend({
}
// Detach control_panel old content and attach new elements
+ var toDetach = this.nodes;
+ if (status.searchview && this.searchview === status.searchview) {
+ // If the searchview is the same as before, don't detach it s.t.
+ // we don't loose any floating content, nor the focus
+ toDetach = _.omit(toDetach, '$searchview');
+ new_cp_content = _.omit(new_cp_content, '$searchview');
+ }
if (options.clear) {
- this._detach_content(this.nodes);
+ this._detach_content(toDetach);
// Show the searchview buttons area, which might have been hidden by
// the searchview, as client actions may insert elements into it
this.nodes.$searchview_buttons.show();
} else {
- this._detach_content(_.pick(this.nodes, _.keys(new_cp_content)));
+ this._detach_content(_.pick(toDetach, _.keys(new_cp_content)));
}
this._attach_content(new_cp_content);
+ if (options.clear || status.searchview) {
+ this.searchview = status.searchview;
+ }
// Update the searchview and switch buttons
if (status.searchview || options.clear) {
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index a12b85abdd0..a0ce8d31af4 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -861,8 +861,16 @@ ListRenderer.include({
*/
_onRemoveIconClick: function (event) {
event.stopPropagation();
- var id = $(event.target).closest('tr').data('id');
- this.trigger_up('list_record_remove', {id: id});
+ var $row = $(event.target).closest('tr');
+ var id = $row.data('id');
+ if ($row.hasClass('o_selected_row')) {
+ this.trigger_up('list_record_remove', {id: id});
+ } else {
+ var self = this;
+ this.unselectRow().then(function () {
+ self.trigger_up('list_record_remove', {id: id});
+ });
+ }
},
/**
* If the list view editable, just let the event bubble. We don't want to