[ADD] basic (and crappy) actions in list view
bzr revid: xmo@openerp.com-20110412145516-b6qobs00g7jt212t
This commit is contained in:
parent
3e54a3d589
commit
3b38e2c688
|
@ -108,6 +108,8 @@ openerp.base.DataSet = openerp.base.Controller.extend( /** @lends openerp.base.
|
|||
this.notification.notify("Unlink", ids);
|
||||
},
|
||||
call: function (method, ids, args, callback) {
|
||||
this.notification.notify(
|
||||
"Calling", this.model + '#' + method + '(' + ids + ')');
|
||||
ids = ids || [];
|
||||
args = args || [];
|
||||
return this.rpc('/base/dataset/call', {
|
||||
|
|
|
@ -43,6 +43,7 @@ openerp.base.ListView = openerp.base.Controller.extend(
|
|||
toolbar:!!this.view_manager.sidebar}, this.on_loaded);
|
||||
},
|
||||
on_loaded: function(data) {
|
||||
var self = this;
|
||||
this.fields_view = data.fields_view;
|
||||
//this.log(this.fields_view);
|
||||
this.name = "" + this.fields_view.arch.attrs.string;
|
||||
|
@ -95,6 +96,22 @@ openerp.base.ListView = openerp.base.Controller.extend(
|
|||
// linking feature
|
||||
e.stopImmediatePropagation();
|
||||
});
|
||||
$table.delegate(
|
||||
'td.oe-field-cell button', 'click', function (e) {
|
||||
var $cell = $(e.currentTarget).closest('td');
|
||||
var col_index = $cell.prevAll('td').length;
|
||||
var field = self.visible_columns[col_index];
|
||||
var action = field.name;
|
||||
|
||||
var $row = $cell.parent('tr');
|
||||
var row = self.rows[$row.prevAll().length];
|
||||
|
||||
var context = _.extend(
|
||||
{}, self.dataset.context, field.context || {});
|
||||
self.dataset.call(action, [row.data.id.value], [context],
|
||||
self.do_reload);
|
||||
e.stopImmediatePropagation();
|
||||
});
|
||||
$table.delegate(
|
||||
'td.oe-record-delete button', 'click', this.do_delete);
|
||||
|
||||
|
|
Loading…
Reference in New Issue