details:   https://code.openbravo.com/erp/devel/pi/rev/c41ba68ffe38
changeset: 22866:c41ba68ffe38
user:      Guillermo Gil <guillermo.gil <at> openbravo.com>
date:      Mon Apr 14 09:28:56 2014 +0200
summary:   Fixed issue 25125:Creating a new Sales Order sets Organization as 
disabled

Moved var Id and compared to form value once autoSave is Done, if it is 
different set isNew as true because the record has changed.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
 |  14 +++++++--
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 2bd8c0fe3cbb -r c41ba68ffe38 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Wed Apr 09 22:38:31 2014 +0530
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Mon Apr 14 09:28:56 2014 +0200
@@ -1536,7 +1536,7 @@
     callback = function (resp, data, req) {
       var index1, index2, view = form.view,
           localRecord, status = resp.status,
-          sessionProperties, keepSelection, gridRefreshCallback, theGrid, 
theId;
+          sessionProperties, keepSelection, gridRefreshCallback, theGrid, 
theId, id = form.getValue('id');
 
       if (this.hasOwnProperty('previousExplicitOffline')) {
         isc.Offline.explicitOffline = this.previousExplicitOffline;
@@ -1545,7 +1545,6 @@
 
       // if no recordIndex then select explicitly
       if (recordIndex === -1) {
-        var id = form.getValue('id');
         record = view.viewGrid.data.find('id', id);
         recordIndex = view.viewGrid.data.indexOf(record);
       }
@@ -1632,8 +1631,15 @@
         // remove any edit info in the grid
         view.viewGrid.discardEdits(recordIndex, null, false, 
isc.ListGrid.PROGRAMMATIC, true);
 
-        // change some labels
-        form.setNewState(false);
+        // Check if Id has changed 
+        if (id === form.getValue('id')) {
+          // Change some labels, set isNew as false
+          form.setNewState(false);
+        } else {
+          // New record, set isNew as true
+          form.setNewState(true);
+        }
+
 
         view.refreshParentRecord();
 

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to