details:   /erp/devel/pi/rev/13ccd47e6a8b
changeset: 12494:13ccd47e6a8b
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Thu May 26 14:58:44 2011 +0200
summary:   Fixes issue 17366: After canceling a new grid edit action the child 
view shows the wrong message

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     |  15 +++++++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 |   1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

diffs (71 lines):

diff -r 39c8f7954afa -r 13ccd47e6a8b 
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
     Thu May 26 14:24:50 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Thu May 26 14:58:44 2011 +0200
@@ -1018,6 +1018,7 @@
   },
   
   resetEmptyMessage: function(criteria){
+    var selectedValues, parentIsNew, oldMessage = this.emptyMessage;
     criteria = criteria || this.getCriteria();
     if (!this.view) {
       this.emptyMessage = this.noDataEmptyMessage;
@@ -1027,16 +1028,21 @@
       this.emptyMessage = this.noDataEmptyMessage;
     } else {
       selectedValues = this.view.parentView.viewGrid.getSelectedRecords();
-      if (selectedValues.length === 0) {
+      parentIsNew = this.view.parentView.isShowingForm && 
this.view.parentView.viewForm.isNew;
+      parentIsNew = parentIsNew || (selectedValues.length === 1 && 
selectedValues[0]._new);
+      if (parentIsNew) {
+        this.emptyMessage = OB.I18N.getLabel('OBUIAPP_ParentIsNew');
+      } else if (selectedValues.length === 0) {
         this.emptyMessage = OB.I18N.getLabel('OBUIAPP_NoParentSelected');
-      } else if (selectedValues.length === 1 && selectedValues[0]._new) {
-        this.emptyMessage = OB.I18N.getLabel('OBUIAPP_ParentIsNew');
       } else if (selectedValues.length > 1) {
         this.emptyMessage = 
OB.I18N.getLabel('OBUIAPP_MultipleParentsSelected');
       } else {
         this.emptyMessage = this.noDataEmptyMessage;
       }
     }
+    if (oldMessage !== this.emptyMessage) {
+      this.markForRedraw();
+    }
   },
   
   // +++++++++++++++++++++++++++++ Context menu on record click 
+++++++++++++++++++++++
@@ -1442,6 +1448,7 @@
     }
     this.createNewRecordForEditing(insertRow);
     this.startEditing(insertRow);
+    this.view.refreshChildViews();
   },
   
   initializeEditValues: function(rowNum, colNum){
@@ -1621,6 +1628,7 @@
         }]);
         me.updateRowCountDisplay();
         me.view.toolBar.updateButtonState(true);
+        me.view.refreshChildViews();
       } else {
         // remove the error style/msg    
         me.setRecordErrorMessage(rowNum, null);
@@ -1630,7 +1638,6 @@
       
       // update after removing the error msg
       this.view.updateTabTitle();
-      this.view.toolBar.updateButtonState(true);
     }
   },
   
diff -r 39c8f7954afa -r 13ccd47e6a8b 
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/main/ob-standard-view.js
 Thu May 26 14:24:50 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Thu May 26 14:58:44 2011 +0200
@@ -897,6 +897,7 @@
     if (!record) { //  new case
       this.viewGrid.deselectAllRecords();
       this.viewForm.editNewRecord(preventFocus);
+      this.refreshChildViews();
     } else {
       this.viewGrid.doSelectSingleRecord(record);
       

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to