diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 18020d92367..0a19f2c72d8 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -20,17 +20,27 @@ openerp.web.Notification = openerp.web.OldWidget.extend(/** @lends openerp.web. expires: 2500 }); }, - notify: function(title, text) { + notify: function(title, text, sticky) { + sticky = !!sticky; + var opts = {}; + if (sticky) { + opts.expires = false; + } this.$element.notify('create', { title: title, text: text - }); + }, opts); }, - warn: function(title, text) { + warn: function(title, text, sticky) { + sticky = !!sticky; + var opts = {}; + if (sticky) { + opts.expires = false; + } this.$element.notify('create', 'oe_notification_alert', { title: title, text: text - }); + }, opts); } }); diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 3f9c3e04cdb..c1eea014070 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -173,7 +173,8 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# on_record_loaded: function(record) { var self = this, set_values = []; if (!record) { - throw new Error("Form: No record received"); + this.do_warn("Form", "The record could not be found in the database.", true); + return $.Deferred().reject(); } this.datarecord = record;