Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0022638Openbravo ERP00. Application dictionarypublic2012-12-19 18:272013-03-04 12:08
VictorVillar 
AugustoMauch 
highminoralways
closedfixed 
5
pi 
3.0MP213.0MP21 
marvintm
Core
No
0022638: Configure the Selector Display Field, of a selector based on a view, does not work
Configure the Selector Display Field, of a selector based on a view, does not work
As System Administrator

 create a new module in development.
 Create a new reference:
 Search as parent reference (because OBUISEL_Selector Reference as parent does not work)
     Defined the selector based on m_product_price_warehouse_v view
     Defined the fields of the selector (copy the Product reference, as a guide) and the product.id as the value field, and Name as Display field.

Assign this reference to the m_product_id column of the c_orderline table

It is not necessary to compile if you have your module in development.

Check it in Purchase/Sales order,
 The product name is OK in grid view, but is not in Form view.
No tags attached.
depends on defect 00225233.0MP22 closed AugustoMauch It is not possible to use the OBUISEL_Selector Reference as parent reference for selectors based on views. 
Issue History
2012-12-19 18:27VictorVillarNew Issue
2012-12-19 18:27VictorVillarAssigned To => AugustoMauch
2012-12-19 18:27VictorVillarModules => Core
2012-12-19 18:27VictorVillarResolution time => 1360710000
2012-12-19 18:27VictorVillarTriggers an Emergency Pack => No
2012-12-19 18:27VictorVillarRelationship addeddepends on 0022523
2012-12-19 18:27VictorVillarIssue Monitored: networkb
2013-01-29 18:42AugustoMauchAssigned ToAugustoMauch => shankarb
2013-01-31 15:27AugustoMauchStatusnew => feedback
2013-02-04 10:07shankarbNote Added: 0056118
2013-02-04 17:07VictorVillarStatusfeedback => scheduled
2013-02-04 17:07VictorVillarfix_in_branch => pi
2013-02-05 17:50jonalegriaesarteTarget Version3.0MP20 => 3.0MP21
2013-02-05 17:50jonalegriaesartefix_in_branchpi =>
2013-02-06 10:34AugustoMauchStatusscheduled => acknowledged
2013-02-06 10:34AugustoMauchAssigned Toshankarb => AugustoMauch
2013-02-06 18:11AugustoMauchStatusacknowledged => scheduled
2013-02-06 18:11AugustoMauchfix_in_branch => pi
2013-02-06 18:12AugustoMauchNote Added: 0056234
2013-02-06 18:12AugustoMauchStatusscheduled => feedback
2013-02-19 09:42VictorVillarStatusfeedback => scheduled
2013-02-19 09:42VictorVillarNote Added: 0056539
2013-02-27 13:38AugustoMauchIssue Monitored: marvintm
2013-02-27 13:38AugustoMauchReview Assigned To => marvintm
2013-02-27 13:38AugustoMauchfix_in_branchpi =>
2013-02-27 13:47hgbotCheckin
2013-02-27 13:47hgbotNote Added: 0056813
2013-02-27 13:47hgbotStatusscheduled => resolved
2013-02-27 13:47hgbotResolutionopen => fixed
2013-02-27 13:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/6549f19a33f28ea6804b8c18b26ae2dbc800ea61 [^]
2013-03-02 05:48hudsonbotCheckin
2013-03-02 05:48hudsonbotNote Added: 0056921
2013-03-04 12:08marvintmStatusresolved => closed
2013-03-04 12:08marvintmFixed in Version => 3.0MP21

Notes
(0056118)
shankarb   
2013-02-04 10:07   
The issue is, reference with Parent Reference as Selector with a view in defined selector does not work. Eg., m_product_price_warehouse_v.

I created a simple view in pi and mapped it to the reference and I was able to save the row properly. Here is the code of the view.

CREATE OR REPLACE VIEW m_product_simple AS
 SELECT m_product.m_product_id AS id, m_product.name AS product
   FROM m_product
 LIMIT 10;

The view m_product_price_warehouse_v has more than one row for each product id and I think that is causing the issue.
(0056234)
AugustoMauch   
2013-02-06 18:12   
I think this issue is not reproducible.

To test it, set the field Name as the Display Field in the Product search reference, restart tomcat, and check that the reference works properly in the Sales Order window.
(0056539)
VictorVillar   
2013-02-19 09:42   
After creating the selector and navigating to Purchase/Sales order, if you create a new register(Header and Line) the problem is not reproducible.
But if you log out and log in, you navigate to Purchase/Sales order window and check one register created you will be able to reproduce it.
(0056813)
hgbot   
2013-02-27 13:47   
Repository: erp/devel/pi
Changeset: 6549f19a33f28ea6804b8c18b26ae2dbc800ea61
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Feb 27 13:46:25 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/6549f19a33f28ea6804b8c18b26ae2dbc800ea61 [^]

Fixes issue 22638: Enables using display fields in selectors based on views

The root problem was in the implementation of DalUtil.getValueFromPath. Two parameters are passed to that function, a BOB and a propertyPath. In selectors based on tables, the property always belongs to the BOB, but this is not always true for selectors based on views. I.e., in the Product selector, if the Product field is selected as value field and the Name field as display field, the following call will be made:

DalUtil.getValueFromPath(productBOB, "product.name").

The product BOB does not have a product (first part of product.name) property, but the view has. This has been solved by making recursive calls to getValueFromPath, stripping each time the first part of the propertyPath. This would be the execution for the previous example:
DalUtil.getValueFromPath(productBOB, "product.name")
   - The productBOB does not have a product property
   - return DalUtil.getValueFromPath(productBOB, "name")
      * The productBOB does have a name property, it returns its value

---
M src/org/openbravo/dal/core/DalUtil.java
---
(0056921)
hudsonbot   
2013-03-02 05:48   
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/f5db629e7058 [^]

Maturity status: Test