diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 6061113642a..8a2020cba47 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -1999,6 +1999,15 @@
.openerp .oe_form .oe_form_field_many2many > .oe-listview .oe_list_pager_single_page {
display: none;
}
+.openerp .oe_list_buttons .oe_list_save {
+ display: none;
+}
+.openerp .oe_list_buttons.oe_editing .oe_list_add, .openerp .oe_list_buttons.oe_editing .oe_alternative {
+ display: none;
+}
+.openerp .oe_list_buttons.oe_editing .oe_list_save {
+ display: inline-block;
+}
.openerp .oe-listview {
position: relative;
}
@@ -2115,20 +2124,6 @@
.openerp .oe-listview-content .numeric input {
text-align: right;
}
-.openerp .oe-listview-content tr.oe_edition th.oe-record-selector {
- padding: 0 6px;
- font-size: 1px;
- letter-spacing: -1px;
- color: transparent;
-}
-.openerp .oe-listview-content tr.oe_edition th.oe-record-selector:before {
- font: 21px "mnmliconsRegular";
- content: "S";
- color: #404040;
-}
-.openerp .oe-listview-content tr.oe_edition th.oe-record-selector input {
- display: none;
-}
.openerp .oe_trad_field.touched {
border: 1px solid green !important;
}
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index a55d1155859..9377c11e2c2 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -1587,6 +1587,15 @@ $colour4: #8a89ba
display: none
// }}}
// ListView {{{
+ .oe_list_buttons
+ .oe_list_save
+ display: none
+ &.oe_editing
+ .oe_list_add, .oe_alternative
+ display: none
+ .oe_list_save
+ display: inline-block
+
.oe-listview
position: relative
.oe_form .oe_form_field
@@ -1666,12 +1675,6 @@ $colour4: #8a89ba
width: 82px
input
text-align: right
-
- tr.oe_edition th.oe-record-selector
- padding: 0 6px
- @include text-to-icon("S")
- input
- display: none
// }}}
// Translation {{{
.oe_trad_field.touched
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 27b39a40b22..aa7ffdb66d4 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -285,7 +285,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
this.$buttons.find('.oe_list_add')
.click(this.proxy('do_add_record'))
- .prop('disabled', grouped && this.options.editable);
+ .prop('disabled', grouped);
this.$buttons.on('click', '.oe_list_button_import', function() {
self.on_sidebar_import();
return false;
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index 61ee6698452..7bc12b325fc 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -29,7 +29,14 @@ openerp.web.list_editable = function (instance) {
self.configure_pager(self.dataset);
self.compute_aggregates();
}
- })
+ });
+
+ this.on('edit:after', this, function () {
+ self.$element.add(self.$buttons).addClass('oe_editing');
+ });
+ this.on('save:after cancel:after', this, function () {
+ self.$element.add(self.$buttons).removeClass('oe_editing');
+ });
},
destroy: function () {
instance.web.bus.off('resize', this, this.resizeFields);
@@ -93,6 +100,10 @@ openerp.web.list_editable = function (instance) {
this.options.editable = ! this.options.read_only && (data.arch.attrs.editable || this.options.editable);
var result = this._super(data, grouped);
if (this.options.editable) {
+ // FIXME: any hook available to ensure this is only done once?
+ this.$buttons
+ .off('click', 'button.oe_list_save')
+ .on('click', 'button.oe_list_save', this.proxy('saveEdition'));
// Editor is not restartable due to formview not being
// restartable
this.editor = this.makeEditor();
@@ -498,33 +509,12 @@ openerp.web.list_editable = function (instance) {
});
instance.web.ListView.List.include(/** @lends instance.web.ListView.List# */{
- init: function () {
- var self = this;
- this._super.apply(this, arguments);
- var selection_handler = _.find(this.$_element.data('events').click, function (h) {
- return h.selector === 'th.oe-record-selector';
- }).handler;
- // TODO: cleaner way to do that?
- this.$_element
- .off('click', 'th.oe-record-selector')
- .on('click', '.oe_edition th.oe-record-selector', function (e) {
- e.stopImmediatePropagation();
- self.view.saveEdition();
- })
- .on('click', 'th.oe-record-selector', selection_handler);
- },
row_clicked: function (event) {
if (!this.options.editable) {
return this._super.apply(this, arguments);
}
- this.edit_record($(event.currentTarget).data('id'));
- },
- /**
- * Edits record currently selected via dataset
- */
- edit_record: function (record_id) {
- return this.view.startEdition(
- record_id ? this.records.get(record_id) : null);
+ var record_id = $(event.currentTarget).data('id');
+ this.view.startEdition(record_id ? this.records.get(record_id) : null);
},
/**
* If a row mapping to the record (@data-id matching the record's id or
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 66a1c02e448..ec5f9c6d9de 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -619,7 +619,9 @@
- or Import
+
+ or Import
+
@@ -663,10 +665,11 @@
-
-
-
- |
+
+
+
+