Support direct opening a record, new mode now also does autosave
authorMartin Taal <martin.taal@openbravo.com>
Tue, 08 Mar 2011 15:27:53 +0100
changeset 11100 3c1ef57fc562
parent 11099 f7e47cafe51c
child 11101 1724a83b0f0c
Support direct opening a record, new mode now also does autosave
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue Mar 08 15:27:13 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue Mar 08 15:27:53 2011 +0100
@@ -113,6 +113,9 @@
     if (hasChanges) {
       this.setHasChanged(true);
     }
+    
+    this.view.setTargetRecordInWindow(record.id);
+    
     return ret;
   },
   
@@ -189,10 +192,12 @@
     // 16064: Autosave error is triggered when closing a tab, even if the form wasn't touched
     // https://issues.openbravo.com/view.php?id=16064
     // this is inline with current behavior
-//    if (isNew) {
-//      // signal that autosave is needed after this
-//      this.view.standardWindow.setDirtyEditForm(this);
-//    }
+    // NOTE: changed to reset the edit form when closing the form, so only there
+    // so autosave always works except when closing if nothing has changed
+    if (isNew) {
+      // signal that autosave is needed after this
+      this.view.standardWindow.setDirtyEditForm(this);
+    }
   },
   
   // reset the focus item to the first item which can get focus