fixes issue 31070: Deleting pop-up is never closed under some circumnstances
authorCarlos Aristu <carlos.aristu@openbravo.com>
Wed, 11 Nov 2015 16:42:20 +0100
changeset 27854 b59a2f4e4a11
parent 27853 cb4dec610d4b
child 27855 bc003391103b
fixes issue 31070: Deleting pop-up is never closed under some circumnstances

The problem was that when removing a record that is being editing, the updateTabTitle function was crashing when trying to access to this.viewGrid.getEditForm().isNew because this.viewGrid.getEditForm() is undefined at that point.

Apart from this, the isEditingGrid is not restored to false when removing a record which is being edited. This caused new errors after removing, because the view is not marked as in non-editing state. For this reason, now the isEditingGrid value is set to false for this case also.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 11 12:22:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 11 16:42:20 2015 +0100
@@ -3572,6 +3572,7 @@
       return;
     }
     this._hidingInlineEditor = true;
+    this.view.isEditingGrid = false;
     if (record && (rowNum === 0 || rowNum)) {
       if (!this.rowHasErrors(rowNum)) {
         record[this.recordBaseStyleProperty] = null;
@@ -3585,7 +3586,6 @@
       } else {
         isc.Log.logDebug('hideInlineEditor has NO record and editColumnLayout', 'OB');
       }
-      this.view.isEditingGrid = false;
       // Update the tab title after the record has been saved or canceled
       // to get rid of the '*' in the tab title
       // See https://issues.openbravo.com/view.php?id=21709
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Nov 11 12:22:58 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Nov 11 16:42:20 2015 +0100
@@ -1837,7 +1837,7 @@
         postFix;
     var suffix = '';
     var hasChanged = this.isShowingForm && (this.viewForm.isNew || this.viewForm.hasChanged);
-    hasChanged = hasChanged || (this.isEditingGrid && (this.viewGrid.hasErrors() || this.viewGrid.getEditForm().isNew || this.viewGrid.getEditForm().hasChanged));
+    hasChanged = hasChanged || (this.isEditingGrid && this.viewGrid.getEditForm() && (this.viewGrid.hasErrors() || this.viewGrid.getEditForm().isNew || this.viewGrid.getEditForm().hasChanged));
     if (hasChanged) {
       prefix = '* ';
     }
@@ -2289,7 +2289,9 @@
     var actionObject = {
       target: this,
       method: this.editRecord,
-      parameters: {isNewDocument: true}
+      parameters: {
+        isNewDocument: true
+      }
     };
     this.standardWindow.doActionAfterAutoSave(actionObject, false);
   },