Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0030800Openbravo ERPA. Platformpublic2015-09-09 12:282015-11-23 21:16
yogaskarnik 
caristu 
normalmajoralways
closedfixed 
5
3.0PR15Q2.4 
3.0PR16Q1 
alostale
Core
No
0030800: Filter on Property field in a table reference column doesn't work
Grid Filtering for a compound property field which base entity is a Table reference in the main entity it is not working.

It tries to filter by the table's displayed column instead of by the correct property.
1. Setup steps
1.1 As system admin
1.2 Open Window, Tabs and Fields
1.3 Open Sales Order, Header tab
1.4 Add a new Field:
  * Name: sales rep
  * Property: salesRepresentative.email
  * Show in Grid View: true

2. Reproduce steps
2.1 Login to ERP
2.2 Open Sales Order
2.3 Create 2 orders with different sales representatives
2.4 In grid view, clear filters (to ensure following filtering will be done in backend)
2.5 Filter by the email of one of these sales representatives
  -> * Grid shows no data
     * Debugging the query to get data it is:
       Order ... left join e.salesRepresentative as join_3 where (( upper(e.salesRepresentative.name) like upper(:alias_0) escape '|'))

Note it is trying to filter by e.salesRepresentative.name instead of e.salesRepresentative.email

Note client (adaptive) filtering is working fine for this case
The problem is caused by org.openbravo.service.json.AdvancedQueryBuilder.getPropertyForTableReference method which is replacing in this case the correct property path by the displayed column of the base table reference to try to solve issue 0026696. Ideally this substitution shouldn't be done in the server side but in client using fields displayProperty to create the correct criteria being in this manner unneeded to do the transformation.
No tags attached.
related to defect 00266963.0PR14Q4 closed shankarb The filter does not work when changing the ad_org_id column to a table reference displayng the value column. 
related to defect 00269503.0PR14Q3 closed AugustoMauch Reference filter in Columns tab is not working properly. 
related to defect 0031304 acknowledged Triage Platform Base Behavior of summary functions with property fields pointing to table references is not correct 
related to defect 0031305 closed platform NullPointerException when creating a new record on the header having a property field 
related to design defect 0031315 acknowledged Triage Platform Base Equals other column filter is not working 
causes defect 0035426 closed inigosanchez Adaptive filtering capability does not work for Table references. 
Issue History
2015-09-09 12:28yogaskarnikNew Issue
2015-09-09 12:28yogaskarnikAssigned To => platform
2015-09-09 12:28yogaskarnikModules => Core
2015-09-09 12:28yogaskarnikResolution time => 1440712800
2015-09-09 12:28yogaskarnikTriggers an Emergency Pack => No
2015-09-09 13:39alostaleNote Added: 0080280
2015-09-09 13:39alostaleAssigned Toplatform => yogaskarnik
2015-09-09 13:39alostaleStatusnew => feedback
2015-10-08 06:18yogaskarnikNote Added: 0080873
2015-10-20 11:11yogaskarnikStatusfeedback => new
2015-10-20 11:11yogaskarnikSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9723#r9723
2015-10-20 12:20yogaskarnikSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9724#r9724
2015-10-26 11:25VictorVillarAssigned Toyogaskarnik => platform
2015-10-26 14:29alostaleRelationship addedrelated to 0026696
2015-10-26 14:30alostaleRelationship addedrelated to 0026950
2015-10-26 15:23alostaleSummaryFilter on Property field does not work => Filter on Property field in a table reference column doesn't work
2015-10-26 15:23alostaleDescription Updatedbug_revision_view_page.php?rev_id=9876#r9876
2015-10-26 15:23alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9877#r9877
2015-10-26 15:23alostaleStatusnew => acknowledged
2015-10-26 15:27alostaleProposed Solution updated
2015-10-26 15:30alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9878#r9878
2015-10-26 15:31alostaleStatusacknowledged => scheduled
2015-10-26 15:31alostaleAssigned Toplatform => caristu
2015-10-29 18:53caristuRelationship addedrelated to 0031304
2015-10-29 18:56caristuRelationship addedrelated to 0031305
2015-10-30 13:04caristuNote Added: 0081404
2015-10-30 13:09hgbotCheckin
2015-10-30 13:09hgbotNote Added: 0081406
2015-10-30 13:09hgbotStatusscheduled => resolved
2015-10-30 13:09hgbotResolutionopen => fixed
2015-10-30 13:09hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/92802596bf940d3c62c8e84547ea21e78055c0fc [^]
2015-10-30 13:53caristuRelationship addedrelated to 0031315
2015-11-02 11:57alostaleReview Assigned To => alostale
2015-11-02 12:45alostaleNote Added: 0081427
2015-11-02 12:45alostaleStatusresolved => closed
2015-11-02 12:45alostaleFixed in Version => 3.0PR16Q1
2015-11-02 12:50alostaleNote Edited: 0081427bug_revision_view_page.php?bugnote_id=0081427#r9981
2015-11-23 21:16hudsonbotCheckin
2015-11-23 21:16hudsonbotNote Added: 0082163
2017-03-07 17:34inigosanchezRelationship addedcauses 0035426

Notes
(0080280)
alostale   
2015-09-09 13:39   
Please, provide more accurate description (what fails, is there any error...) and steps to reproduce (what does "foreign key field in Sales Order with a List reference" mean?) indicating the exact steps rather than generic ones.
(0080873)
yogaskarnik   
2015-10-08 06:18   
Waiting for access to the environment so that we can analyze the logs.
(0081404)
caristu   
2015-10-30 13:04   
Summary of the Test Cases for the fix: https://docs.google.com/spreadsheets/d/1P5S8vXmyNZxdTiUOAosIFci9zmuanPVk0IjU5X99Ktg/edit#gid=0 [^]
(0081406)
hgbot   
2015-10-30 13:09   
Repository: erp/devel/pi
Changeset: 92802596bf940d3c62c8e84547ea21e78055c0fc
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Oct 30 13:08:22 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/92802596bf940d3c62c8e84547ea21e78055c0fc [^]

fixes issue 30800: Filter on Property field in a table ref column doesn't work
Now the value used to filter a column based on a table reference is set on the client. We make use an attribute called displayProperty which is only set for Table references. This way, the change is transparent for the rest of FK references.
By setting this value in the client, the replacement done in the server (in AvanceQueryBuilder.parseSimpleClause() method) is not needed anymore.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKComboUIDefinition.java
M modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
---
(0081427)
alostale   
2015-11-02 12:45   
(edited on: 2015-11-02 12:50)
code reviewed

Tested:
* It is possible to filter correctly
* The request sends the correct display field
  - for property fields
  - for table reference
  - for table dir reference
* Tested related issues:
  - 0026696
  - 0026950
* Additional test cases: https://docs.google.com/spreadsheets/d/1P5S8vXmyNZxdTiUOAosIFci9zmuanPVk0IjU5X99Ktg/edit#gid=0 [^]

(0082163)
hudsonbot   
2015-11-23 21:16   
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/7b56bebaaa88 [^]
Maturity status: Test