[imp] made related work from form view
bzr revid: nicolas.vanhoren@openerp.com-20110826130335-fjt0c5f7s7ug2jdl
This commit is contained in:
parent
393f146d77
commit
a703147436
|
@ -441,6 +441,10 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormVi
|
|||
values[key] = val;
|
||||
});
|
||||
return values;
|
||||
},
|
||||
get_selected_ids: function() {
|
||||
var id = this.dataset.ids[this.dataset.index];
|
||||
return id ? [id] : [];
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -597,8 +597,11 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
|
|||
$footer_cells.filter(_.sprintf('[data-field=%s]', column.id))
|
||||
.html(openerp.base.format_cell(aggregation, column));
|
||||
});
|
||||
},
|
||||
get_selected_ids: function() {
|
||||
//TODO niv: this is false
|
||||
debugger;
|
||||
}
|
||||
// TODO: implement reorder (drag and drop rows)
|
||||
});
|
||||
openerp.base.ListView.List = openerp.base.Class.extend( /** @lends openerp.base.ListView.List# */{
|
||||
/**
|
||||
|
|
|
@ -432,9 +432,23 @@ openerp.base.Sidebar = openerp.base.Widget.extend({
|
|||
item.callback();
|
||||
}
|
||||
if (item.action) {
|
||||
item.action.flags = item.action.flags || {};
|
||||
item.action.flags.new_window = true;
|
||||
self.do_action(item.action);
|
||||
var ids = self.widget_parent.get_selected_ids();
|
||||
if (ids.length == 0) {
|
||||
//TODO niv: maybe show a warning?
|
||||
return false;
|
||||
}
|
||||
self.rpc("/base/action/load", {
|
||||
action_id: item.action.id,
|
||||
context: {
|
||||
active_id: ids[0],
|
||||
active_ids: ids,
|
||||
active_model: self.widget_parent.dataset.model
|
||||
}
|
||||
}, function(result) {
|
||||
result.result.flags = result.result.flags || {};
|
||||
result.result.flags.new_window = true;
|
||||
self.do_action(result.result);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue