diff --git a/src/tab.js b/src/tab.js index 7fa95a02fa..4613b861f5 100644 --- a/src/tab.js +++ b/src/tab.js @@ -288,8 +288,7 @@ this.set_buttons_sensitive(); this.view_prm = this.screen.switch_view().done(function() { - this.set_name(attributes.name || - this.screen.current_view.attributes.string); + this.set_name(attributes.name || ''); this.el.append(screen.screen_container.el); if (attributes.res_id) { screen.group.load([attributes.res_id]); @@ -813,7 +812,7 @@ this.view_id = (attributes.view_ids.length > 0 ? attributes.view_ids[0] : null); this.context = attributes.context; - this.name = attributes.name; + this.name = attributes.name || ''; this.dialogs = []; this.board = null; UIView = new Sao.Model('ir.ui.view'); diff --git a/src/view/form.js b/src/view/form.js index d6c71162c3..3e704fa6b7 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -1737,7 +1737,8 @@ } }; win = new Sao.Window.Form(screen, callback.bind(this), { - save_current: true + save_current: true, + title: this.attributes.string }); return; } @@ -1764,7 +1765,8 @@ '').split(','), views_preload: (this.attributes.views || {}), new_: this.create_access(), - search_filter: parser.quote(text) + search_filter: parser.quote(text), + title: this.attributes.string }); return; } @@ -1787,7 +1789,8 @@ }; var win = new Sao.Window.Form(screen, callback.bind(this), { new_: true, - save_current: true + save_current: true, + title: this.attributes.string }); }, key_press: function(event_) { @@ -1866,7 +1869,8 @@ views_preload: (this.attributes.views || {}), new_: this.create_access(), - search_filter: parser.quote(text) + search_filter: parser.quote(text), + title: this.attributes.string }); } } @@ -2355,7 +2359,8 @@ '').split(','), views_preload: this.attributes.views || {}, new_: !this.but_new.prop('disabled'), - search_filter: parser.quote(text) + search_filter: parser.quote(text), + title: this.attributes.string }); }, remove: function(event_) { @@ -2393,7 +2398,8 @@ var win = new Sao.Window.Form(this.screen, function() {}, { new_: true, many: field_size, - context: context + context: context, + title: this.attributes.string }); } }, @@ -2430,7 +2436,9 @@ sel_multi: true, context: context, domain: domain, - search_filter: '' + search_filter: '', + title: this.attributes.string + }); }; @@ -2500,7 +2508,8 @@ this.validate().done(function() { var record = this.screen.current_record; if (record) { - var win = new Sao.Window.Form(this.screen, function() {}); + var win = new Sao.Window.Form(this.screen, function() {}, + {title: this.attributes.string}); } }.bind(this)); }, @@ -2687,7 +2696,8 @@ '').split(','), views_preload: this.attributes.views || {}, new_: this.attributes.create, - search_filter: parser.quote(value) + search_filter: parser.quote(value), + title: this.attributes.string }); }, remove: function() { @@ -2739,7 +2749,8 @@ } }.bind(this); screen.switch_view().done(function() { - new Sao.Window.Form(screen, callback); + new Sao.Window.Form(screen, callback, + {title: this.attributes.string}); }); }, new_: function() { @@ -2768,7 +2779,8 @@ screen.switch_view().done(function() { new Sao.Window.Form(screen, callback, { 'new_': true, - 'save_current': true + 'save_current': true, + title: this.attributes.string }); }); } @@ -3305,7 +3317,8 @@ context: context, domain: domain, new_: false, - search_filter: parser.quote(value) + search_filter: parser.quote(value), + title: this.attributes.string }); }, add_new_keys: function(ids) { diff --git a/src/window.js b/src/window.js index 9a0c7fe852..288deffa25 100644 --- a/src/window.js +++ b/src/window.js @@ -45,6 +45,7 @@ this.domain = kwargs.domain || null; this.context = kwargs.context || null; this.save_current = kwargs.save_current; + this.title = kwargs.title || ''; this.prev_view = screen.current_view; this.screen.screen_container.alternate_view = true; this.info_bar = new Sao.Window.InfoBar(); @@ -215,7 +216,7 @@ switch_prm.done(function() { - dialog.add_title(this.screen.current_view.attributes.string); + dialog.add_title(this.title); dialog.body.append(this.screen.screen_container.alternate_viewport); this.el.modal('show'); }.bind(this)); @@ -383,8 +384,7 @@ init: function(record, callback) { this.resource = record.model.name + ',' + record.id; this.attachment_callback = callback; - var context = jQuery.extend({}, record.get_context()); - context.resource = this.resource; + var title = Sao.i18n.gettext('Attachments (%1)', record.rec_name); var screen = new Sao.Screen('ir.attachment', { domain: [['resource', '=', this.resource]], mode: ['tree', 'form'], @@ -395,7 +395,7 @@ screen.search_filter(); }); Sao.Window.Attachment._super.init.call(this, screen, this.callback, - {view_type: 'tree'}); + {view_type: 'tree', title: title}); }, callback: function(result) { var prm = jQuery.when(); @@ -416,8 +416,7 @@ init: function(record, callback) { this.resource = record.model.name + ',' + record.id; this.note_callback = callback; - var context = record.get_context(); - context.resource = this.resource; + var title = Sao.i18n.gettext('Notes (%1)', record.rec_name); var screen = new Sao.Screen('ir.note', { domain: [['resource', '=', this.resource]], mode: ['tree', 'form'], @@ -428,7 +427,7 @@ screen.search_filter(); }); Sao.Window.Note._super.init.call(this, screen, this.callback, - {view_type: 'tree'}); + {view_type: 'tree', title: title}); }, callback: function(result) { var prm = jQuery.when(); @@ -460,7 +459,9 @@ this.context = kwargs.context || {}; this.sel_multi = kwargs.sel_multi; this.callback = callback; - var dialog = new Sao.Dialog('Search', '', 'lg'); + this.title = kwargs.title || ''; + var dialog = new Sao.Dialog(Sao.i18n.gettext( + 'Search %1', this.title), '', 'lg'); this.el = dialog.modal; jQuery('