diff --git a/addons/base/static/src/js/form.js b/addons/base/static/src/js/form.js index 45db4d0f9ec..bbcee8f363e 100644 --- a/addons/base/static/src/js/form.js +++ b/addons/base/static/src/js/form.js @@ -921,9 +921,7 @@ openerp.base.form.FieldMany2Many = openerp.base.form.Field.extend({ }); openerp.base.form.Many2ManyListView = openerp.base.ListView.extend({ - do_delete: function (e) { - e.stopImmediatePropagation(); - var ids = [this.rows[$(e.currentTarget).closest('tr').prevAll().length].data.id.value]; + do_delete: function (ids) { this.dataset.ids = _.without.apply(null, [this.dataset.ids].concat(ids)); this.dataset.count = this.dataset.ids.length; // there may be a faster way @@ -943,14 +941,11 @@ openerp.base.form.Many2ManyListView = openerp.base.ListView.extend({ 'context': this.dataset.context }, this.do_fill_table); }, - do_add_record: function (e) { - e.stopImmediatePropagation(); + do_add_record: function () { // TODO: need to open a popup with search view }, - on_select_row: function(event) { - var $target = $(event.currentTarget); - var row = this.rows[$target.prevAll().length]; - var id = row.data.id.value; + select_record: function(index) { + var id = this.rows[index].data.id.value; if(! id) { return; } diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js index b8f9b498578..70ab1110baa 100644 --- a/addons/base/static/src/js/list.js +++ b/addons/base/static/src/js/list.js @@ -83,7 +83,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi id, self.do_reload); }, 'row_link': function (e, index) { - self.switch_to_record(index); + self.select_record(index); } }); @@ -236,7 +236,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi * @param {Number|null} index the record index (in the current dataset) to switch to * @param {String} [view="form"] the view type to switch to */ - switch_to_record:function (index, view) { + select_record:function (index, view) { view = view || 'form'; this.dataset.index = index; _.delay(_.bind(function () { @@ -349,7 +349,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi */ do_add_record: function () { this.notification.notify('Add', "New record"); - this.switch_to_record(null); + this.select_record(null); }, /** * Handles deletion of all selected lines