[FIX] web: no formview dialog during editable list edition

Clicking on an editable list row makes the row editable. Clicking on
an editable list row while another row is being edited, first make
the row being edited readonly before making the clicked row editable.
The row which goes back to readonly have to be reloaded, operation
which is not instantaneous. If another row is clicked while a row
is going back to readonly (this typically happens if a row is double
clicked while another one is being edited), a form view dialog was
opened to edit the row (behavior which was not expected).

opw-710627
This commit is contained in:
qsm-odoo
2017-03-27 10:35:55 +02:00
parent 92d25e7f08
commit eac7e16e20
@@ -828,6 +828,10 @@ ListView.List.include(/** @lends instance.web.ListView.List# */{
if (!this.view.editable() || !this.view.is_action_enabled('edit')) {
return this._super.apply(this, arguments);
}
if (this.__is_starting_edition) {
return;
}
this.__is_starting_edition = true;
var self = this;
var args = arguments;
@@ -839,6 +843,8 @@ ListView.List.include(/** @lends instance.web.ListView.List# */{
focus_field: $(event.target).not(".o_readonly").data('field'),
}).fail(function() {
return _super.apply(self, args); // The record can't be edited so open it in a modal (use-case: readonly mode)
}).always(function () {
self.__is_starting_edition = false;
});
},
/**