Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028432Openbravo ERPA. Platformpublic2014-12-17 10:182014-12-30 23:28
alostale 
AugustoMauch 
immediateminorhave not tried
closedfixed 
5
 
3.0PR15Q13.0PR15Q1 
dbaz
Core
Coding ( Testing )
2014-11-25
pi
https://code.openbravo.com/erp/devel/pi/rev/059f8 [^]
No
0028432: can't filter product FK drop down in return windows P&E
In "Return from Customer"/"Return to Vendor" windows, "Pick Lines" process, when there is a translation installed it is not possible to filter product name in FK drop down list.
-Install Spanish Translation
-Go to "Return to Vendor" window (no matter if session language is English or Spanish)
-Create a line
-Click on "Pick/Edit Lines" button
-Type "a" in the product filter
  -Drop down list is opened (OK)
  -"No items to show" message is displayed -> Error
  -This error can appears is log
1f923ef8 1716159 [http-8080-2] ERROR org.openbravo.client.kernel.KernelUtils - unexpected token: t near line 1, column 2622 [select iol.id as id, iol.organization as organization, iol.client as client, iol.product as product, iol.uOM as uOM, iol.id as goodsShipmentLine, iol.movementQuantity as movementQuantity, iol.shipmentReceipt.businessPartner as businessPartner, iol.shipmentReceipt.documentNo as shipmentNumber, iol.shipmentReceipt.movementDate as movementDate, attributeSetValue as attributeSetValue, coalesce((select sum(ol.orderedQuantity) from OrderLine as ol left join ol.salesOrder as o where ol.goodsShipmentLine = iol and o.processed = true and o.documentStatus <> 'VO'), 0) as returnQtyOtherRM, (case when (select ('Y') from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) is null then false else true end) as obSelected, coalesce((select ol.orderedQuantity from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol),0)*(-1) as returned, (select ol.returnReason from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) as returnReason, coalesce((select ol.tax from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) , (select e.salesOrderLine.tax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)) as tax, (case when (select e.salesOrderLine.salesOrder.priceList.priceIncludesTax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol) = true then coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (select e.salesOrderLine.grossUnitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)) else coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (select e.salesOrderLine.unitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)) end) as unitPrice, (select e.salesOrderLine.salesOrder.documentNo from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol) as orderNo FROM MaterialMgmtShipmentInOutLine as iol left join iol.attributeSetValue as attributeSetValue join iol.shipmentReceipt as io where io.businessPartner.id = :businessPartnerId and io.processed = true and io.documentStatus <> 'VO' and io.salesTransaction = false and 1 = 1 and iol.client.id in ('0', '23C59575B9CF467C9620760EB255B389') AND iol.organization in ('E443A31992CB4635AFCAEABE7183CE85','0','19404EAD144C49A0AF37D54377CF452D','B843C30461EA4501935CB1D125C9C25A') AND ( iol.id = :alias_0 or upper((COALESCE(to_char((select name from ProductTrl as t t.product = product and t.language.language='en_US')), to_char(iol.product.name), ''))) like upper(:alias_1) escape '|' ) AND (io.movementDate >= (now() - 90) or (case when (select ('Y') from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) is null then false else true end) = true) ORDER BY obSelected desc, obSelected desc, io.movementDate desc, io.documentNo desc, iol.lineNo]

No tags attached.
related to feature request 00259963.0PR14Q3 closed AugustoMauch HQL based tables 
causes defect 0028545 closed alostale Some filters in Grids built on HQL Based Table they don't work any more 
causes defect 0029212 closed AugustoMauch can't filter multiple products in return from/to P&Es 
causes defect 0029224 closed AugustoMauch can't filter by Return Reason in Return P&E windows 
causes defect 0029241 closed AugustoMauch can't filter by Attribute Set Value in Return P&E windows 
Issue History
2014-12-17 10:18alostaleNew Issue
2014-12-17 10:18alostaleAssigned To => alostale
2014-12-17 10:18alostaleModules => Core
2014-12-17 10:18alostaleRegression level => Coding ( Testing )
2014-12-17 10:18alostaleRegression introduced in release => pi
2014-12-17 10:18alostaleTriggers an Emergency Pack => No
2014-12-17 10:19alostalePrioritynormal => immediate
2014-12-17 15:54alostaleSummarycan't filter product in return windows => can't filter product FK drop down in return windows P&E
2014-12-18 10:57alostaleRelationship addedrelated to 0025996
2014-12-18 11:02alostaleRegression date => 2014-11-25
2014-12-18 11:02alostaleRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/059f8 [^]
2014-12-18 11:08alostaleNote Added: 0072692
2014-12-18 11:09alostaleAssigned Toalostale => AugustoMauch
2014-12-18 11:09alostaleNote Edited: 0072692bug_revision_view_page.php?bugnote_id=0072692#r7289
2014-12-22 19:15AugustoMauchNote Added: 0072779
2014-12-23 09:30AugustoMauchIssue Monitored: dbaz
2014-12-23 09:31AugustoMauchReview Assigned To => dbaz
2014-12-23 09:42hgbotCheckin
2014-12-23 09:42hgbotNote Added: 0072787
2014-12-23 09:42hgbotStatusnew => resolved
2014-12-23 09:42hgbotResolutionopen => fixed
2014-12-23 09:42hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/95dd177fbbc7f18d448b3e31cc12b67dbc0cb87d [^]
2014-12-23 09:51AugustoMauchNote Added: 0072788
2014-12-23 16:36dbazNote Added: 0072800
2014-12-23 16:36dbazStatusresolved => closed
2014-12-23 16:36dbazFixed in Version => 3.0PR15Q1
2014-12-30 23:28hudsonbotCheckin
2014-12-30 23:28hudsonbotNote Added: 0073260
2015-01-09 09:51alostaleRelationship addedcauses 0028545
2015-03-10 10:33alostaleRelationship addedcauses 0029212
2015-03-10 19:18AugustoMauchRelationship addedcauses 0029224
2015-03-10 19:18AugustoMauchRelationship addedcauses 0029225
2015-03-11 11:26AugustoMauchRelationship addedcauses 0029241

Notes
(0072692)
alostale   
2014-12-18 11:08   
(edited on: 2014-12-18 11:09)
The problem is in HQLDataSourceService.addAdditionalFilters method. In this case the filterWhereClauseParameter is:

 where ( upper((COALESCE(to_char((select name from ProductTrl as t where t.product = product and t.language.language='en_US')), to_char(iol.product.name), ''))) like upper(:alias_0) escape '|' )

In line 555 all occurrences of where are removed, resulting in:

 ( upper((COALESCE(to_char((select name from ProductTrl as t t.product = product and t.language.language='en_US')), to_char(iol.product.name), ''))) like upper(:alias_0) escape '|' )

Note the subquery is no valid anymore, it is:

... from ProductTrl as t t.product=...

but it should be

... from ProductTrl as t ***where*** t.product=...

Should we remove just the initial where instead of all of them or is there any case where this is not correct?

(0072779)
AugustoMauch   
2014-12-22 19:15   
Fix pushed to try.
(0072787)
hgbot   
2014-12-23 09:42   
Repository: erp/devel/pi
Changeset: 95dd177fbbc7f18d448b3e31cc12b67dbc0cb87d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Dec 22 19:14:54 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/95dd177fbbc7f18d448b3e31cc12b67dbc0cb87d [^]

Fixes issue 28432: HQLDataSourceService manages translations properly

There were several problems related with the handling of translatable columns in the HQLDataSourceService class:
- If there was a translation installed, the query done to retrieve some data that contained a translatable column threw an exception. This was because the WHERE constant of the inner query done to retrieve the translated string was being removed. The regex that handled this has been improved so that now only the leading WHERE constant is removed.
- After fixing that the query no longer threw an exception but it did not return the proper results. This happened because the query was not properly built, due to not using the entity alias in the query builder.
- After that, the translated string was not being shown when the filter drop down was populated. This has been fixed by changing the way this information is obtained. Previously only the id and the (not translated) identifier was obtained using the query. Now the whole BaseOBObject is retrieved, and it is used later to obtain its id and its potentially tranlated identifier.

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java
---
(0072788)
AugustoMauch   
2014-12-23 09:51   
Test plan:
- Install the spanish localization pack. There is no need to set Spanish as the systems default language.
- Open the Pick&Execute window of Return to Customer and clear the filters. Choose any product you see there, and add a translation to it in the Translation subtab of the Product window.
- Open the Pick&Execute window again, now the name of the product should be the translated one.
- Open the filter drop down of the Product column, the name of the product should be the translated one.
- Try filtering translated and not translated columns.
(0072800)
dbaz   
2014-12-23 16:36   
Reviewed @ changeset: 25592 - dd9596bfd555
(0073260)
hudsonbot   
2014-12-30 23:28   
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/6525fe229e06 [^]
Maturity status: Test