Solved smaller bugs in standard window
authorMartin Taal <martin.taal@openbravo.com>
Tue, 25 Jan 2011 23:51:27 +0100
changeset 10131 8007b8d1d5ba
parent 10130 1b9e9f910f8c
child 10132 4569470336c6
Solved smaller bugs in standard window
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js	Tue Jan 25 23:50:40 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js	Tue Jan 25 23:51:27 2011 +0100
@@ -58,6 +58,8 @@
   initWidget: function(){
     var standardWindow = this;
     
+    this.views = [];
+    
     this.toolBarLayout = isc.HLayout.create({
       width: '100%',
       height: 1, // is set by its content
@@ -179,21 +181,18 @@
   },
   
   draw: function(){
-    var standardWindow = this;
+    var standardWindow = this, targetEntity;
     var ret = this.Super('draw', arguments);
     
     if (this.targetTabId) {
-      // no entity, try to find it
-      if (!this.targetEntity) {
-        for (var i = 0; i < this.views.length; i++) {
-          if (this.views[i].tabId === this.targetTabId) {
-            this.targetEntity = this.view.entity;
-            break;
-          }
+      for (var i = 0; i < this.views.length; i++) {
+        if (this.views[i].tabId === this.targetTabId) {
+          targetEntity = this.views[i].entity;
+          break;
         }
       }
       OB.RemoteCallManager.call('org.openbravo.client.application.window.ComputeSelectedRecordActionHandler', null, {
-        targetEntity: this.targetEntity,
+        targetEntity: targetEntity,
         targetRecordId: this.targetRecordId,
         windowId: this.windowId
       }, function(response, data, request){
@@ -202,7 +201,6 @@
       });
       delete this.targetRecordId;
       delete this.targetTabId;
-      delete this.targetEntity;
     } else if (this.command === isc.OBStandardWindow.COMMAND_NEW) {
       var currentView = this.activeView || this.view;
       currentView.editRecord();