diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py index d60ed63ac4f..1abfaa7c323 100644 --- a/addons/base/controllers/main.py +++ b/addons/base/controllers/main.py @@ -324,7 +324,7 @@ def fix_view_modes(action): generate_views(action) if action.pop('view_type') != 'form': - return + return action action['views'] = [ [id, mode if mode != 'tree' else 'list'] diff --git a/addons/base/static/lib/qweb/qweb2.js b/addons/base/static/lib/qweb/qweb2.js index e617df60183..4f136f3c98a 100644 --- a/addons/base/static/lib/qweb/qweb2.js +++ b/addons/base/static/lib/qweb/qweb2.js @@ -304,6 +304,7 @@ QWeb2.Engine = (function() { " /* START TEMPLATE */ try {\n" + (e.compile()) + "\n" + " /* END OF TEMPLATE */ } catch(error) {\n" + + " if (console && console.exception) console.exception(error);\n" + " context.engine.tools.exception('Runtime Error: ' + error, context);\n" + " }\n" + " return r.join('');"; diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index a4c1b22cf4f..ebaf457daa2 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -845,6 +845,7 @@ openerp.base.Dialog = openerp.base.BaseWidget.extend({ this.$dialog.dialog('close'); }, stop: function () { + this.close(); this.$dialog.dialog('destroy'); } }); @@ -921,6 +922,11 @@ openerp.base.Login = openerp.base.Controller.extend({ this.selected_db = localStorage.getItem('last_db_login_success'); this.selected_login = localStorage.getItem('last_login_login_success'); } + if (jQuery.deparam(jQuery.param.querystring()).debug != undefined) { + this.selected_db = this.selected_db || "trunk"; + this.selected_login = this.selected_login || "admin"; + this.selected_password = this.selected_password || "a"; + } }, start: function() { var self = this; diff --git a/addons/base/static/src/js/form.js b/addons/base/static/src/js/form.js index e7b25fb94ea..7faa942c6b0 100644 --- a/addons/base/static/src/js/form.js +++ b/addons/base/static/src/js/form.js @@ -1321,10 +1321,12 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({ } this.$input.focusout(anyoneLoosesFocus); + var isSelecting = false; // autocomplete this.$input.autocomplete({ source: function(req, resp) { self.get_search_result(req, resp); }, select: function(event, ui) { + isSelecting = true; var item = ui.item; if (item.id) { self._change_int_value([item.id, item.name]); @@ -1342,6 +1344,14 @@ openerp.base.form.FieldMany2One = openerp.base.form.Field.extend({ minLength: 0, delay: 0 }); + // used to correct a bug when selecting an element by pushing 'enter' in an editable list + this.$input.keyup(function(e) { + if (e.which === 13) { + if (isSelecting) + e.stopPropagation(); + } + isSelecting = false; + }); }, // autocomplete component content handling get_search_result: function(request, response) { @@ -1811,7 +1821,8 @@ openerp.base.form.SelectCreatePopup = openerp.base.BaseWidget.extend({ this.initial_ids = this.options.initial_ids; jQuery(this.render()).dialog({title: '', modal: true, - minWidth: 800}); + width: 960, + height: 600}); this.start(); }, start: function() { diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js index 60d9e3b552c..c1df8857f08 100644 --- a/addons/base/static/src/js/list.js +++ b/addons/base/static/src/js/list.js @@ -256,11 +256,12 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi if (column.modifiers) { var modifiers = JSON.parse(column.modifiers); column.modifiers_for = function (fields) { - var result = {}; - for (var modifier in modifiers) { - result[modifier] = domain_computer(modifiers[modifier], fields); + if (!modifiers.invisible) { + return {}; } - return result; + return { + 'invisible': domain_computer(modifiers.invisible, fields) + }; }; } else { column.modifiers_for = noop; diff --git a/addons/base/static/src/js/views.js b/addons/base/static/src/js/views.js index a43f79527dd..da50e62c713 100644 --- a/addons/base/static/src/js/views.js +++ b/addons/base/static/src/js/views.js @@ -9,7 +9,7 @@ openerp.base.ActionManager = openerp.base.Controller.extend({ init: function(session, element_id) { this._super(session, element_id); this.viewmanager = null; - this.dialog_stack = []; + this.current_dialog = null; // Temporary linking view_manager to session. // Will use controller_parent to find it when implementation will be done. session.action_manager = this; @@ -22,34 +22,44 @@ openerp.base.ActionManager = openerp.base.Controller.extend({ var self = this; action.flags = _.extend({ sidebar : action.target != 'new', - search_view : true, + search_view : action.target != 'new', new_window : false, - views_switcher : true, - action_buttons : true, - pager : true + views_switcher : action.target != 'new', + action_buttons : action.target != 'new', + pager : action.target != 'new' }, action.flags || {}); // instantiate the right controllers by understanding the action + if (this.current_dialog) { + this.current_dialog.stop(); + this.current_dialog = null; + } + if (this.current_dialog) { + this.current_dialog.stop(); + this.current_dialog = null; + } else if (this.view_manager && this.view_manager.current_dialog) { + this.view_manager.current_dialog.stop(); + this.view_manager.current_dialog = null; + } switch (action.type) { case 'ir.actions.act_window': - if (!action.target && this.dialog_stack.length) { + if (!action.target && this.current_dialog) { action.flags.new_window = true; } if (action.target == 'new') { - var element_id = _.uniqueId("act_window_dialog"); - $('
| + + | +
| + + | +