[ADD] reimplement o2m's cancel-on-blur when no alteration has been done by the user to the row being edited (new or not)

bzr revid: xmo@openerp.com-20120718134607-bukj6c5lysmqeer3
This commit is contained in:
Xavier Morel 2012-07-18 15:46:07 +02:00
parent f19e5ff9bc
commit 9096f2c45c
1 changed files with 8 additions and 1 deletions

View File

@ -3331,13 +3331,20 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
/** /**
* Handles blurring of the nested form (saves the currently edited row), * Handles blurring of the nested form (saves the currently edited row),
* unless the flag to ignore the event is set to ``true`` * unless the flag to ignore the event is set to ``true``
*
* Makes the internal form go away
*/ */
_on_form_blur: function () { _on_form_blur: function () {
if (this.__ignore_blur) { if (this.__ignore_blur) {
this.__ignore_blur = false; this.__ignore_blur = false;
return; return;
} }
this.save_edition(); // FIXME: why isn't there an API for this?
if (this.editor.form.$element.hasClass('oe_form_dirty')) {
this.save_edition();
return;
}
this.cancel_edition();
}, },
keyup_ENTER: function () { keyup_ENTER: function () {
// blurring caused by hitting the [Return] key, should skip the // blurring caused by hitting the [Return] key, should skip the