details:   https://code.openbravo.com/erp/devel/pi/rev/2510c39ff5e9
changeset: 24299:2510c39ff5e9
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Fri Aug 22 11:06:59 2014 +0200
summary:   Fixes issue 27406: Toolbar buttons are somtimes disabled using tree 
grid view

The problem was on the definition of the getParentRecord function. In certain 
conditions it was using the standard grid, when it should have used the tree 
grid.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 |  17 ++++++---
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r b368521a3d6d -r 2510c39ff5e9 
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 Jul 17 13:58:34 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Fri Aug 22 11:06:59 2014 +0200
@@ -1770,19 +1770,24 @@
 
   getParentRecord: function () {
     var grid = null;
-    if (!this.parentView || !this.parentView.viewGrid.getSelectedRecords() || 
this.parentView.viewGrid.getSelectedRecords().length !== 1) {
+    // if there is no parent view, there is no parent record
+    if (!this.parentView) {
       return null;
     }
-
-    // a new parent is not a real parent
-    if (this.parentView.viewGrid.getSelectedRecord()._new) {
-      return null;
-    }
+    // use the standard tree of the tree grid depending on the view being shown
     if (this.parentView.isShowingTree) {
       grid = this.parentView.treeGrid;
     } else {
       grid = this.parentView.viewGrid;
     }
+    // if the parent grid does not have exactly one selected record, return 
null
+    if (!grid.getSelectedRecords() || grid.getSelectedRecords().length !== 1) {
+      return null;
+    }
+    // a new parent is not a real parent
+    if (!this.parentView.isShowingTree && 
this.parentView.viewGrid.getSelectedRecord()._new) {
+      return null;
+    }
     return grid.getSelectedRecord();
   },
 

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to