Fixes issue 27957: Grid button don't get stuck after autosaving new record
authorAugusto Mauch <>
Fri, 24 Oct 2014 09:38:26 +0200
changeset 25359 2e8b032171e0
parent 25148 6af26661c789
child 25360 379709296e4d
Fixes issue 27957: Grid button don't get stuck after autosaving new record

In the fix [1] of this issue [2], a change was made to force reselecting a new record even if it was already selected, because otherwise when a record was created in grid mode while a filter was applied, when the record was saved the selection was lost.

The problem is that that change should only be applied when the editCompletionEvent is 'programmatic'. In the other cases (i.e. 'tab', 'enter', etc), the focus goes to another record, so it did not apply to [2]. In fact when the editCompletion event is not 'programmatic' not only reselecting the record was not needed, but also it caused the grid buttons to get stuck.

--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Thu Oct 23 17:31:32 2014 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Fri Oct 24 09:38:26 2014 +0200
@@ -2897,7 +2897,9 @@
     this.view.standardWindow.autoSaveDone(this.view, true);
     // if nothing else got selected, select ourselves then
-    if (!this.getSelectedRecord() || (this.getSelectedRecord().id === record._originalId)) {
+    // if there is already a record selected, only force reselecting that record if the editCompletionEvent was 'programmatic', 
+    // otherwise ('enter', 'tab', etc) it is not needed, and doing it causes  
+    if (!this.getSelectedRecord() || (editCompletionEvent === 'programmatic' && this.getSelectedRecord().id === record._originalId)) {
       keepSelection = true;