[ADD] Add sticky option to do_warn() and do_notify()
[IMP] Form view uses a notification when a record is not found in the database bzr revid: fme@openerp.com-20120213123805-4dqg4oioous25nuo
This commit is contained in:
parent
9552dbc215
commit
ba05ec55fd
|
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue