[IMP] Form view sidebar actions like print should implicitly save the record
bzr revid: fme@openerp.com-20111114110239-g2s034i66rmhh2ne
This commit is contained in:
parent
a85abc9e8e
commit
54bde62da0
|
@ -673,6 +673,26 @@ session.web.Sidebar = session.web.Widget.extend({
|
|||
item.callback.apply(self, [item]);
|
||||
}
|
||||
if (item.action) {
|
||||
if (self.widget_parent instanceof session.web.FormView) {
|
||||
self.widget_parent.do_save(function() {
|
||||
self.on_item_action_clicked(item);
|
||||
});
|
||||
} else {
|
||||
self.on_item_action_clicked(item);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
var $ul = $section.find('ul');
|
||||
if(!$ul.length) {
|
||||
$ul = $('<ul/>').appendTo($section);
|
||||
}
|
||||
$items.appendTo($ul);
|
||||
}
|
||||
},
|
||||
on_item_action_clicked: function(item) {
|
||||
var self = this;
|
||||
var ids = self.widget_parent.get_selected_ids();
|
||||
if (ids.length == 0) {
|
||||
//TODO: make prettier warning?
|
||||
|
@ -697,16 +717,6 @@ session.web.Sidebar = session.web.Widget.extend({
|
|||
result.result.flags.new_window = true;
|
||||
self.do_action(result.result);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
var $ul = $section.find('ul');
|
||||
if(!$ul.length) {
|
||||
$ul = $('<ul/>').appendTo($section);
|
||||
}
|
||||
$items.appendTo($ul);
|
||||
}
|
||||
},
|
||||
do_fold: function() {
|
||||
this.$element.addClass('closed-sidebar').removeClass('open-sidebar');
|
||||
|
|
Loading…
Reference in New Issue