fixes issue 31434: Error after cancel record creation in grid view and refresh
authorCarlos Aristu <carlos.aristu@openbravo.com>
Wed, 11 Nov 2015 19:12:51 +0100
changeset 27855 bc003391103b
parent 27854 b59a2f4e4a11
child 27856 760f25c01ef4
fixes issue 31434: Error after cancel record creation in grid view and refresh

The problem was that when refreshing after cancelling the record creation in grid view, the refresh request was done considering that an existing record was selected. To avoid this problem, now after canceling, the getSelectedRecord() is cleared if the canceled record is a new one.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 11 16:42:20 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 11 19:12:51 2015 +0100
@@ -3292,6 +3292,11 @@
 
       // remove the record if new
       if (record && record._new) {
+        // after cancelling a not saved record, the value for the selected record should be cleared
+        // see issue https://issues.openbravo.com/view.php?id=31434
+        if (me.selection && me.getSelectedRecord()) {
+          me.selection.deselect(me.getSelectedRecord());
+        }
         totalRows = me.data.totalRows;
         me.data.handleUpdate('remove', [{
           id: record.id