[FIX] Many2ManyListView based on changes in ListView API.
bzr revid: xmo@openerp.com-20110512095711-85drteuvprr22ggs
This commit is contained in:
parent
d1ba33bfb6
commit
b392412371
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue