Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038061Openbravo ERPA. Platformpublic2018-03-06 17:502018-03-13 17:24
vmromanos 
alostale 
normalmajoralways
closedfixed 
5
 
3.0PR18Q23.0PR18Q2 
caristu
Core
No
0038061: Selector filter expression with OB.isSalesTransaction() doesn't work when called from a Process Definition
The "On Hand Locator" reference has the following filter expression:

"((" + OB.isSalesTransaction() + " [...]

When the selector is inside a normal tab it's working fine, however when the selector is included into a Process Definition the following error is printed into the log:

1823852 [http-apr-8080-exec-10] ERROR org.openbravo.userinterface.selector.SelectorDefaultFilterActionHandler - Error generating Default Filter action result: id to load is required for loading
java.lang.IllegalArgumentException: id to load is required for loading
    at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:89)
    at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:61)
    at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1002)
    at org.openbravo.dal.core.SessionHandler.find(SessionHandler.java:534)
    at org.openbravo.dal.core.SessionHandler.find(SessionHandler.java:500)
    at org.openbravo.dal.service.OBDal.get(OBDal.java:353)
    at org.openbravo.client.application.window.ApplicationDictionaryCachedStructures.getWindow(ApplicationDictionaryCachedStructures.java:170)
    at org.openbravo.client.application.window.ApplicationDictionaryCachedStructures$Proxy$_$$_WeldClientProxy.getWindow(ApplicationDictionaryCachedStructures$Proxy$_$$_WeldClientProxy.java)
    at org.openbravo.client.application.OBBindings.isSalesTransaction(OBBindings.java:142)
    at jdk.nashorn.internal.scripts.Script$5$\^eval\_.:program(<eval>:1)
    at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:637)
    at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
    at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
    at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:449)
    at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
    at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
    at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
    at org.openbravo.base.expression.OBScriptEngine.eval(OBScriptEngine.java:57)
    at org.openbravo.userinterface.selector.SelectorDefaultFilterActionHandler.execute(SelectorDefaultFilterActionHandler.java:152)
    at org.openbravo.client.kernel.BaseActionHandler.execute(BaseActionHandler.java:73)
    at org.openbravo.userinterface.selector.SelectorDefaultFilterActionHandler$Proxy$_$$_WeldClientProxy.execute(SelectorDefaultFilterActionHandler$Proxy$_$$_WeldClientProxy.java)
    at org.openbravo.client.kernel.KernelServlet.processActionRequest(KernelServlet.java:314)
    at org.openbravo.client.kernel.KernelServlet.doGet(KernelServlet.java:206)
    at org.openbravo.client.kernel.KernelServlet.doPost(KernelServlet.java:287)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at org.openbravo.base.HttpBaseServlet.serviceInitialized(HttpBaseServlet.java:221)
    at org.openbravo.base.secureApp.HttpSecureAppServlet.service(HttpSecureAppServlet.java:462)
    at org.openbravo.client.kernel.BaseKernelServlet.callServiceInSuper(BaseKernelServlet.java:87)
    at org.openbravo.client.kernel.BaseKernelServlet.service(BaseKernelServlet.java:58)
    at org.openbravo.client.kernel.KernelServlet.service(KernelServlet.java:168)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:35)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.openbravo.client.kernel.KernelFilter$1.doAction(KernelFilter.java:62)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
    at org.openbravo.client.kernel.KernelFilter.doFilter(KernelFilter.java:71)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.openbravo.dal.core.DalRequestFilter$1.doAction(DalRequestFilter.java:83)
    at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:46)
    at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:105)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2522)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2511)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)





After debugging I have realized the problem is OBBindings.getWindowId() method, which returns NULL when the selector is defined into a Process Definition.
Later on the OBBindings.isSalesTransaction() method throws the NPE because it tries to recover a window with NULL ad_window_id.
In a recent PI.
As F&B Admin:

Go to Referenced Inventory Type window and create any record for US org
Go to Referenced Inventory window and create any record for West org linked to previous Referenced Inventory Type
Press Box button.
In the process definition, press the storage bin selector's magnifying glass button.
Check the openbravo.log for the exception
Ensure the selector receives the window from which it was called even when inside a Process Definition called from a window.
No tags attached.
related to feature request 00378273.0PR18Q2 closed vmromanos Referenced Inventory 
related to defect 0027529 closed AugustoMauch Parameter Windows should use the context of its owner tab to initialize the parameters 
related to defect 0037437 closed alostale useless session cache of window.isSOTrx 
related to defect 00380393.0PR18Q2 closed jarmendariz Organization filtering issues in Process Definition selectors 
causes defect 0038548 closed caristu Default Expression in Selector Field does not work properly 
Issue History
2018-03-06 17:50vmromanosNew Issue
2018-03-06 17:50vmromanosAssigned To => platform
2018-03-06 17:50vmromanosModules => Core
2018-03-06 17:50vmromanosTriggers an Emergency Pack => No
2018-03-06 17:51vmromanosTarget Version => 3.0PR18Q2
2018-03-06 17:52vmromanosRelationship addedrelated to 0037827
2018-03-06 17:54vmromanosSummarySelector filter expression with OB.isSalesTransaction() doesn't work => Selector filter expression with OB.isSalesTransaction() doesn't work when called from a Process Definition
2018-03-06 17:54vmromanosDescription Updatedbug_revision_view_page.php?rev_id=16813#r16813
2018-03-06 17:54vmromanosSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=16815#r16815
2018-03-07 12:35alostaleRelationship addedrelated to 0027529
2018-03-07 12:35alostaleRelationship addedrelated to 0037437
2018-03-07 12:36alostaleRelationship addedrelated to 0038039
2018-03-07 17:27hgbotCheckin
2018-03-07 17:27hgbotNote Added: 0103066
2018-03-07 17:27hgbotStatusnew => resolved
2018-03-07 17:27hgbotResolutionopen => fixed
2018-03-07 17:27hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2a79f597da83870d152ee3176ffa679a01ac19d5 [^]
2018-03-07 17:27alostaleAssigned Toplatform => alostale
2018-03-07 17:28alostaleReview Assigned To => caristu
2018-03-08 16:51hudsonbotCheckin
2018-03-08 16:51hudsonbotNote Added: 0103095
2018-03-12 14:00hgbotCheckin
2018-03-12 14:01hgbotNote Added: 0103160
2018-03-12 14:11hgbotCheckin
2018-03-12 14:13hgbotNote Added: 0103161
2018-03-12 16:24caristuNote Added: 0103164
2018-03-12 16:24caristuStatusresolved => closed
2018-03-12 16:24caristuFixed in Version => 3.0PR18Q2
2018-03-13 17:24hudsonbotCheckin
2018-03-13 17:24hudsonbotNote Added: 0103212
2018-03-13 17:24hudsonbotCheckin
2018-03-13 17:24hudsonbotNote Added: 0103213
2018-05-14 18:58AtulOpenbravoRelationship addedcauses 0038548

Notes
(0103066)
hgbot   
2018-03-07 17:27   
Repository: erp/devel/pi
Changeset: 2a79f597da83870d152ee3176ffa679a01ac19d5
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Wed Mar 07 12:40:14 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2a79f597da83870d152ee3176ffa679a01ac19d5 [^]

fixed bug 38061: isSoTrx filter expression doesn't work from Process Definition

  When using OB.isSalesTransaction in a filter expression for a selector used in
  a process definition it failed.

  The problem was caused because in this case window information was not sent to
  SelectorDefaultFilterActionHandler.

  The fix includes:
   * Covering this case to send window id
   * OBBindings.isSalesTransaction not to throw NPE in case window is not set
   * Send this information as part of the POST payload rather than in the query string
   * Don't send duplicated information in request query string and payload to
     SelectorDefaultFilterActionHandler, do it only as payload

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
M modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
---
(0103095)
hudsonbot   
2018-03-08 16:51   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/bce7d98857dd [^]
Maturity status: Test
(0103160)
hgbot   
2018-03-12 14:00   
Repository: erp/devel/pi
Changeset: f8144ae28d38e4d274846ce852667652e7397287
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Mar 12 14:00:10 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/f8144ae28d38e4d274846ce852667652e7397287 [^]

related to issue 38061: add javadoc information

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
---
(0103161)
hgbot   
2018-03-12 14:11   
Repository: erp/devel/pi
Changeset: 447278fc8b1cc3fe39fb3f0b0b2bb9845e0eda01
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Mon Mar 12 14:08:21 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/447278fc8b1cc3fe39fb3f0b0b2bb9845e0eda01 [^]

related to bug 38061: don't get windowId|ISSOTRX attribute if windowId is null

  Micro-optimization: if the windowId is null, then do not try to retrieve the windowId|ISSOTRX attribute and return null immediately.

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/OBBindings.java
---
(0103164)
caristu   
2018-03-12 16:23   
Code reviewed + tested OK.
(0103212)
hudsonbot   
2018-03-13 17:24   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/1d3ccc92fab6 [^]
Maturity status: Test
(0103213)
hudsonbot   
2018-03-13 17:24   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/1d3ccc92fab6 [^]
Maturity status: Test