Fixed issue 28623: Window's behaviour changes when creating a new record.
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Mon, 19 Jan 2015 14:42:57 +0100
changeset 25693 d5c6e81a234b
parent 25692 7cf1a163acc1
child 25694 373b808b426c
Fixed issue 28623: Window's behaviour changes when creating a new record.

When a window is opened using the "quick create new" widget, the same window in the recent views layout
does not allow to create a new record (the green small button for creating a new record, which should be
by the window name, disappears).

The problem was in the "ob-utilities.js", inside the "{OB.Utilities.openView}" function, the logic for
setting the "singleRecord" value (this is the Edit Only attribute) was wrong. If the value of the
variable singleRecord of that function was undefined or null, as it was in the case of clicking the "quick create new"
widget, that value was set to true and the window became an "edit only" window.That was why the small
green "create new" icon disappeared from the recent views layout.

For fixing this the condition has been removed, so we know that the value of the variable "singleRecord" is not
going to be modified and it will be set correctly.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Wed Jan 14 18:44:36 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Mon Jan 19 14:42:57 2015 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -421,18 +421,13 @@
 // Returns the object used to open the window.
 OB.Utilities.openView = function (windowId, tabId, tabTitle, recordId, command, icon, readOnly, singleRecord, direct, editOrDeleteOnly) {
   var isClassicEnvironment = OB.Utilities.useClassicMode(windowId),
-      openObject, isDirect = direct,
-      isSingleRecord;
+      openObject, isDirect = direct;
   if (recordId) {
     if (direct !== false) {
       isDirect = true;
     }
 
   }
-  if (singleRecord !== false) {
-    isSingleRecord = true;
-  }
-
   if (isClassicEnvironment) {
     if (recordId) {
       OB.Layout.ClassicOBCompatibility.openLinkedItem(tabId, recordId);
@@ -456,7 +451,7 @@
       tabTitle: tabTitle,
       windowId: windowId,
       readOnly: readOnly,
-      singleRecord: isSingleRecord,
+      singleRecord: singleRecord,
       editOrDeleteOnly: editOrDeleteOnly
     };
   } else {
@@ -468,7 +463,7 @@
       windowId: windowId,
       icon: icon,
       readOnly: readOnly,
-      singleRecord: isSingleRecord,
+      singleRecord: singleRecord,
       editOrDeleteOnly: editOrDeleteOnly
     };
   }