[FIX] in ensure_saved, discard non-dirty editable rows

if the editable row's form isn't dirty, either nothing has been
entered in a new row or an existing row (being edited) has not been
altered, so can just discard the row (and reload it from cache if it's
an edition).

bzr revid: xmo@openerp.com-20120613153633-ms7i8t9lvdarxqi3
This commit is contained in:
Xavier Morel 2012-06-13 17:36:33 +02:00
parent 533f17231c
commit 9f9bbcff33
1 changed files with 7 additions and 1 deletions

View File

@ -332,7 +332,13 @@ openerp.web.list_editable = function (openerp) {
*/
ensure_saved: function () {
if (this.edition) {
return this.save_row();
// kinda-hack-ish: if the user has entered data in a field,
// oe_form_dirty will be set on the form so save, otherwise
// discard the current (entirely empty) line
if (this.edition_form.$element.is('.oe_form_dirty')) {
return this.save_row();
}
return this.cancel_pending_edition();
}
//noinspection JSPotentiallyInvalidConstructorUsage
return $.when();