summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2016-06-02 14:26:41 +0200
committerGéry Debongnie <ged@odoo.com>2016-06-02 14:28:21 +0200
commit9be5531f3e80ceb009d8f65abee22ec39010dc05 (patch)
treefdd5499895f8ac73c2abdf55683a8ff8b7748e2b /addons/web/static/src
parent969bc66e7ad26c2006ceb1ff4d677408e25afab2 (diff)
[FIX] web: fix actions in sidebar on second reload
When the user visited a view for the second time, the extra actions in the sidebar were broken. The reason is that the sidebar code modified in place the fields_view information. Note: This was not a problem before, because the field_view_get call was done each time the view was loaded, but now it is cached.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/widgets/sidebar.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/addons/web/static/src/js/widgets/sidebar.js b/addons/web/static/src/js/widgets/sidebar.js
index e2222526320..03997db6c36 100644
--- a/addons/web/static/src/js/widgets/sidebar.js
+++ b/addons/web/static/src/js/widgets/sidebar.js
@@ -103,13 +103,13 @@ var Sidebar = Widget.extend({
_.each(['print','action','relate'], function(type) {
var items = toolbar[type];
if (items) {
- for (var i = 0; i < items.length; i++) {
- items[i] = {
- label: items[i]['name'],
- action: items[i],
+ var actions = _.map(items, function (item) {
+ return {
+ label: item.name,
+ action: item,
};
- }
- self.add_items(type=='print' ? 'print' : 'other', items);
+ });
+ self.add_items(type === 'print' ? 'print' : 'other', actions);
}
});
},
@@ -218,4 +218,3 @@ var Sidebar = Widget.extend({
return Sidebar;
});
-