summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-06-13 17:36:33 +0200
committerXavier Morel <xmo@openerp.com>2012-06-13 17:36:33 +0200
commit9f9bbcff33a5a3153a22ea6f736b8c668c4f5a81 (patch)
treeccfc7eb6efbc14217ceb8ffdbd8aa9c4eb0a1fe5 /addons/web/static/src
parent533f17231c1aee913b8806c1e39339851514d15b (diff)
[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
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_list_editable.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index 728652edc5f..7a0645138bf 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -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();