diff options
| author | Géry Debongnie <ged@odoo.com> | 2016-06-02 14:26:41 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2016-06-02 14:28:21 +0200 |
| commit | 9be5531f3e80ceb009d8f65abee22ec39010dc05 (patch) | |
| tree | fdd5499895f8ac73c2abdf55683a8ff8b7748e2b /addons/web/static/src/js | |
| parent | 969bc66e7ad26c2006ceb1ff4d677408e25afab2 (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/js')
| -rw-r--r-- | addons/web/static/src/js/widgets/sidebar.js | 13 |
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; }); - |
