Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0039214Openbravo ERP00. Application dictionarypublic2018-09-03 11:172022-02-01 08:07
dmiguelez 
Triage Platform Base 
highmajoralways
newopen 
5
 
 
Core
No
0039214: Allow to use replacements in WhereClause of Tab definitions when the Table is defined as an HQL query
When there is a Table defined through AD as an HQL Query, it is possible to create a Window and a Tab over this Table.

However, in the Where Clause of the Tab, the expressions that use replacements (like @ad_client_id@) are not working for this scenario
Apply this patch and compile the application updating the database:

diff --git a/src-db/database/sourcedata/AD_TAB.xml b/src-db/database/sourcedata/AD_TAB.xml
--- a/src-db/database/sourcedata/AD_TAB.xml
+++ b/src-db/database/sourcedata/AD_TAB.xml
@@ -15986,6 +15986,7 @@
 <!--652123A308954FE8AA072DE90EE7C988--> <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
 <!--652123A308954FE8AA072DE90EE7C988--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--652123A308954FE8AA072DE90EE7C988--> <UIPATTERN><![CDATA[RO]]></UIPATTERN>
+<!--652123A308954FE8AA072DE90EE7C988--> <HQLWHERECLAUSE><![CDATA[(olpr.client.id = @ad_client_id@)]]></HQLWHERECLAUSE>
 <!--652123A308954FE8AA072DE90EE7C988--> <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
 <!--652123A308954FE8AA072DE90EE7C988--> <DISPLAYLOGIC><![CDATA[@HASRELATEDSERVICE@='Y']]></DISPLAYLOGIC>
 <!--652123A308954FE8AA072DE90EE7C988--> <DISABLE_PARENT_KEY_PROPERTY><![CDATA[N]]></DISABLE_PARENT_KEY_PROPERTY>


Log in as F&B Admin

Go to Product Window and create a new record with:
  - Organization: *
  - Search Key: Test
  - Name: Test
  - Product Type: Service
  - Linked to Product: Yes
  - Included Product Categories: All excluding defined
  - Included Products: All excluding defined
  - Quantity Rule: As per product
  - Proposal Type: Mandatory proposal
Move to Price Tab and create a new record with:
  - Price List version: Tarifa de ventas
  - Unit Price: 10
  - List Price: 10

Go to Sales Order window and create a new record with:
  - Organization: F&B España - Región Norte
  - Business Partner: Alimentos y Supermercados
Move to lines tab and create a new record with:
  - Product: Agua Sin Gas
  - Ordered Quantity: 10
Create another line with:
  - Product: Test
  - Operative Quantity: 10
Click on select order line button and select the previous line (Agua Sin Gas)

Move to the Tab Related products.

Check and error is raised, and the log shows:

128275 [http-bio-8080-exec-9] ERROR org.openbravo.service.datasource.DataSourceServlet - org.hibernate.QueryException: unexpected char: '@' [select olpr.id, olpr.salesOrderLine, olpr.orderlineRelated, so.documentNo, sol.lineNo, sol.product, at as attributeSetValue, olpr.amount, olpr.quantity from OrderlineServiceRelation olpr join olpr.salesOrderLine as sol join sol.salesOrder as so left join sol.attributeSetValue as at WHERE olpr.client.id in ('0', '23C59575B9CF467C9620760EB255B389') AND olpr.organization in ('0','E443A31992CB4635AFCAEABE7183CE85','B843C30461EA4501935CB1D125C9C25A','BAE22373FEBE4CCCA24517E23F0C8A48','DC206C91AA6A4897B44DA897936E0EC3','19404EAD144C49A0AF37D54377CF452D','2E60544D37534C0B89E765FE29BC0B43','7BABA5FF80494CAFA54DEBD22EC46F01') AND (( olpr.orderlineRelated.id = :alias_0 )) AND (olpr.client.id = @ad_client_id@) ORDER BY sol.lineNo, olpr.id]
java.lang.IllegalArgumentException: org.hibernate.QueryException: unexpected char: '@' [select olpr.id, olpr.salesOrderLine, olpr.orderlineRelated, so.documentNo, sol.lineNo, sol.product, at as attributeSetValue, olpr.amount, olpr.quantity from OrderlineServiceRelation olpr join olpr.salesOrderLine as sol join sol.salesOrder as so left join sol.attributeSetValue as at WHERE olpr.client.id in ('0', '23C59575B9CF467C9620760EB255B389') AND olpr.organization in ('0','E443A31992CB4635AFCAEABE7183CE85','B843C30461EA4501935CB1D125C9C25A','BAE22373FEBE4CCCA24517E23F0C8A48','DC206C91AA6A4897B44DA897936E0EC3','19404EAD144C49A0AF37D54377CF452D','2E60544D37534C0B89E765FE29BC0B43','7BABA5FF80494CAFA54DEBD22EC46F01') AND (( olpr.orderlineRelated.id = :alias_0 )) AND (olpr.client.id = @ad_client_id@) ORDER BY sol.lineNo, olpr.id]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:133)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:715)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:731)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:105)
    at org.openbravo.service.datasource.HQLDataSourceService.getQuery(HQLDataSourceService.java:358)
    at org.openbravo.service.datasource.HQLDataSourceService.getData(HQLDataSourceService.java:186)
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetchJSONObject(ReadOnlyDataSourceService.java:146)
    at org.openbravo.service.datasource.ReadOnlyDataSourceService.fetch(ReadOnlyDataSourceService.java:74)
    at org.openbravo.service.datasource.DataSourceServlet.doFetch(DataSourceServlet.java:289)
    at org.openbravo.service.datasource.DataSourceServlet.doPost(DataSourceServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
No tags attached.
Issue History
2018-09-03 11:17dmiguelezNew Issue
2018-09-03 11:17dmiguelezAssigned To => platform
2018-09-03 11:17dmiguelezModules => Core
2018-09-03 11:17dmiguelezTriggers an Emergency Pack => No
2018-09-10 12:28caristuNote Added: 0106657
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base

Notes
(0106657)
caristu   
2018-09-10 12:28   
Note that HQLInserters most probably can be used as a workaround for this feature request: http://wiki.openbravo.com/wiki/How_to_create_a_HQL_Based_Table#HQL_Inserters [^]