[REF] web: prevent useless rerender in some cases

When clicking on a form button, the saveRecord method is called, which
will then call the toReadonlymode method, which will rerender the form
view, even if it was already in readonly mode.
This commit is contained in:
Géry Debongnie
2017-04-11 19:44:38 +02:00
committed by Aaron Bohy
parent 2bca653584
commit a529a928b4
@@ -368,8 +368,10 @@ var FormController = BasicController.extend({
* @private
*/
_toReadOnlyMode: function () {
this.$el.removeClass('o_form_editable');
this.update({mode: "readonly"}, {reload: false});
if (this.mode !== 'readonly') {
this.$el.removeClass('o_form_editable');
this.update({mode: "readonly"}, {reload: false});
}
},
/**
* Updates the controller's title according to the new state