diff options
| author | Géry Debongnie <ged@odoo.com> | 2014-10-29 15:43:10 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2014-10-31 14:59:06 +0100 |
| commit | 4df2e6dee377fc42e9021cb0c8f1c1e0e9b3772d (patch) | |
| tree | 33f3d586827545f03133394a151cb001db83ccf1 /addons/web/static | |
| parent | c4f3f06fbf73401834228cada3669e2003693971 (diff) | |
[IMP] display breadcrumbs content in browser tabs
this change is simple, except that many actions display a form view in
'create' mode to edit some stuff (for example, most settings forms or
the 'Your session' action in point of sale).
As a work around, we use
a simple heuristic (nice word for horrible hack): the title displayed
is the title of the action if we have a single form view.
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/views.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index e6ea273859e..3c161190334 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -81,6 +81,18 @@ instance.web.ActionManager = instance.web.Widget.extend({ } }), true); }, + get_title: function () { + if (this.widgets.length === 1) { + // horrible hack to display the action title instead of "New" for the actions + // that use a form view to edit something that do not correspond to a real model + // for example, point of sale "Your Session" or most settings form, + var widget = this.widgets[0]; + if (widget instanceof instance.web.ViewManager && widget.view_stack.length === 1) { + return widget.title; + } + } + return _.pluck(this.get_breadcrumbs(), 'title').join(' / '); + }, history_back: function() { var widget = _.last(this.widgets); if (widget instanceof instance.web.ViewManager) { @@ -132,7 +144,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ // this action has been explicitly marked as not pushable return; } - state.title = this.inner_action.name; + state.title = this.get_title(); if(this.inner_action.type == 'ir.actions.act_window') { state.model = this.inner_action.res_model; } |
