summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/view_list_editable.js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-11-16 17:44:16 +0100
committerXavier Morel <xmo@openerp.com>2012-11-16 17:44:16 +0100
commit86842fe9c8129d3530c622875c2ad5ec8d06e8a0 (patch)
tree175fc03465b316b2ffdb08055a37df1a3870944a /addons/web/static/src/js/view_list_editable.js
parent4a454397f80dc535acb476016827a56842a782ad (diff)
[FIX] correctly handle case of deleting-an-o2m-line-being-edited
move special case in o2m listview to main editable and expand to correctly fit edition cases, not just work in case of creation issue: if a row being edited is deleted in an o2m, the form will be blurred and try cancelling/saving the edition and reloading the row, but this will only happen *after* the record/row/whatever has been "deleted" and (amongst other things) removed from the buffered o2m cache, leading to a tentative read on the server side (usually with a local id which doesn't even make sense) and thus an error. Intercept the deletion signal to cancel the edition immediately and only let the deletion through after the edition has successfully been canceled. bzr revid: xmo@openerp.com-20121116164416-8kr39t6jtqy2s3jc
Diffstat (limited to 'addons/web/static/src/js/view_list_editable.js')
-rw-r--r--addons/web/static/src/js/view_list_editable.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index 8bcf8b5d036..1abe3caab39 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -77,6 +77,15 @@ openerp.web.list_editable = function (instance) {
do_edit: function (index, id, dataset) {
_.extend(this.dataset, dataset);
},
+ do_delete: function (ids) {
+ var _super = this._super.bind(this);
+ var next = this.editor.is_editing()
+ ? this.cancel_edition(true)
+ : $.when();
+ return next.then(function () {
+ return _super(ids);
+ });
+ },
editable: function () {
return this.fields_view.arch.attrs.editable
|| this._context_editable