diff options
Diffstat (limited to 'addons/web/static/src/js/view_list_editable.js')
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 038593c54c3..3a574c30e56 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -281,16 +281,17 @@ openerp.web.list_editable = function (instance) { }); }, /** + * @param {Boolean} [force=false] discards the data even if the form has been edited * @return {jQuery.Deferred} */ - cancel_edition: function () { + cancel_edition: function (force) { var self = this; return this.with_event('cancel', { editor: this.editor, form: this.editor.form, cancel: false }, function () { - return this.editor.cancel().pipe(function (attrs) { + return this.editor.cancel(force).pipe(function (attrs) { if (attrs.id) { var record = self.records.get(attrs.id); if (!record) { @@ -717,13 +718,13 @@ openerp.web.list_editable = function (instance) { return self.cancel(); }); }, - cancel: function () { - var record = this.record; - this.record = null; - if (!this.form.can_be_discarded()) { + cancel: function (force) { + if (!(force || this.form.can_be_discarded())) { return $.Deferred().reject({ message: "The form's data can not be discarded"}).promise(); } + var record = this.record; + this.record = null; this.form.do_hide(); return $.when(record); } |
