Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038734Openbravo ERPA. Platformpublic2018-06-11 18:412022-02-01 08:08
dmiguelez 
Triage Platform Base 
urgentmajoralways
newopen 
5
 
 
Core
No
0038734: Default Expression of Field in OBUISEL_Selector definition is mixing js and hql expressions, and is not working in all scenarios
Default Expression of Field in OBUISEL_Selector definition is mixing js and hql expressions, and is not working in all scenarios.

This default expression is used to pre-filter fields in a grid, which is done using a js expression. But it is also used in the hql created for the drop down list. js and hql expressions can class in some cases.
As System Admin

Go to Reference window and look for one named Product Complete.
Move to Defined Selector || Defined Selector field Tab
Look for the field named Quantity on Hand.
In the Default Expression field put: '>0'

Change Role to F&B Admin

Go to Goods Shipment Window. Create a header.
Move to lines and click on the Product selector.
Clicking on the magnifying glass works, the expression >0 is used to pre-filter the grid.

Clicking on the arrow for the drop down list throws this error in the log:
4026063 [http-bio-8080-exec-3] ERROR org.hibernate.hql.PARSER - line 1:982: unexpected token: >
4026064 [http-bio-8080-exec-3] ERROR org.openbravo.service.json.DefaultJsonDataService - Exception when creating query select e from ProductStockView as e left join e.product as join_0 where ( ( e.organization in ('0','097E2B5F86394085B84832391860905E','E70BD74CE0E4432D9A8B22C43B12CD4C','BF67B59606F643E08CCC51A1CD93ECD5','B9BA55A1633440C4B8BAB5A66A569A10') ) and (e.active='Y' and ( ('169' in ('800051', '800052', '800096') and e.product.production = true and e.stocked = false) or ('169' in ('800053', 'FF808181323E504701323E57E08D0017') and e.product.production = true) or ('169' in ('170') and e.product.stocked = true) or ('169' in ('800092') and e.product.purchase = true) or ('169' in ('169') and (e.warehouse.id is null or e.warehouse.id in (select ow.warehouse.id from OrganizationWarehouse ow where ow.organization.id = 'BF67B59606F643E08CCC51A1CD93ECD5'))) or '169' not in ('800051', '800052', '800053', 'FF808181323E504701323E57E08D0017', '800096','170','800092','169')) and e.storageBin.warehouse.id = 'F7E634AE3D904FE6B8503D604ED2C5B5' and e.stocked = true and e.quantityOnHand = >0) ) and e.client.id in (:_dal_readableClients_dal_) and e.active='Y' order by join_0.name,join_0.id
org.openbravo.base.exception.OBException: Exception when creating query select e from ProductStockView as e left join e.product as join_0 where ( ( e.organization in ('0','097E2B5F86394085B84832391860905E','E70BD74CE0E4432D9A8B22C43B12CD4C','BF67B59606F643E08CCC51A1CD93ECD5','B9BA55A1633440C4B8BAB5A66A569A10') ) and (e.active='Y' and ( ('169' in ('800051', '800052', '800096') and e.product.production = true and e.stocked = false) or ('169' in ('800053', 'FF808181323E504701323E57E08D0017') and e.product.production = true) or ('169' in ('170') and e.product.stocked = true) or ('169' in ('800092') and e.product.purchase = true) or ('169' in ('169') and (e.warehouse.id is null or e.warehouse.id in (select ow.warehouse.id from OrganizationWarehouse ow where ow.organization.id = 'BF67B59606F643E08CCC51A1CD93ECD5'))) or '169' not in ('800051', '800052', '800053', 'FF808181323E504701323E57E08D0017', '800096','170','800092','169')) and e.storageBin.warehouse.id = 'F7E634AE3D904FE6B8503D604ED2C5B5' and e.stocked = true and e.quantityOnHand = >0) ) and e.client.id in (:_dal_readableClients_dal_) and e.active='Y' order by join_0.name,join_0.id
    at org.openbravo.dal.service.OBQuery.createQuery(OBQuery.java:266)
No tags attached.
related to feature request 0038596 closed vmromanos Modules Show available quantity in Product selector in Distribution order Issue Window 
Issue History
2018-06-11 18:41dmiguelezNew Issue
2018-06-11 18:41dmiguelezAssigned To => platform
2018-06-11 18:41dmiguelezModules => Core
2018-06-11 18:41dmiguelezTriggers an Emergency Pack => No
2018-06-11 18:42dmiguelezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17279#r17279
2018-06-11 18:43dmiguelezRelationship addedrelated to 0038596
2018-06-12 13:07caristuNote Added: 0105092
2018-06-12 13:10caristuNote Edited: 0105092bug_revision_view_page.php?bugnote_id=0105092#r17287
2018-06-12 13:11caristuNote Edited: 0105092bug_revision_view_page.php?bugnote_id=0105092#r17288
2022-02-01 08:08alostaleAssigned Toplatform => Triage Platform Base

Notes
(0105092)
caristu   
2018-06-12 13:07   
(edited on: 2018-06-12 13:11)
Indeed, Default Selector Field Expressions are used by two different components, with different purposes. That explains why they are interpreted in a different way depending on the case:

- SelectorDataSourceFilter (selector drop-down): to compute the HQL where and filter clause.
- SelectorDefaultFilterActionHandler (selector pop-up): generates the JS expressions that will be applied into the pop-up. Smartclient will transform them into the corresponding criterias.

According to the documentation[1] these are JS expressions, so it seems that the component that is not using them properly is the SelectorDataSourceFilter.

[1] http://wiki.openbravo.com/wiki/Projects:Selector/Default_Filter_Expressions#Default_Expression_at_Selector_Field_level [^]