Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0022523Openbravo ERP00. Application dictionarypublic2012-12-12 10:302013-03-22 09:35
VictorVillar 
AugustoMauch 
highminoralways
closedfixed 
5
 
3.0MP223.0MP22 
marvintm
Core
No
0022523: It is not possible to use the OBUISEL_Selector Reference as parent reference for selectors based on views.
It is not possible to use the OBUISEL_Selector Reference as parent reference for selectors based on views.
As System Administrator

 create a new module in development.
 Create a new reference:
 OBUISEL_Selector Reference as parent reference
     Defined the selector based on m_product_price_warehouse_v view
     Defined the fields of the selector and the product.id as the value field.

Assign this reference to the m_product_id column of the c_orderline table
Compile, restart tomcat.

Check it in Purchase/Sales order,
Not possible to save a line, error:

"La acción de guardado falló. New object ProductByPriceAndWarehouse(null) (key: 1000310_ProductByPriceAndWarehouse) refered to but not present in the import set"

Also, it is not possible to navigate to the product window from the green arrow of the top of the selector field.
If the reference created has "Search" as parent reference, owrks fine.
No tags attached.
blocks defect 00226383.0MP21 closed AugustoMauch Configure the Selector Display Field, of a selector based on a view, does not work 
? issue22523.export (2,242) 2013-02-28 11:59
https://issues.openbravo.com/file_download.php?file_id=6006&type=bug
? org.openbravo.issue22523-1.0.0.obx (3,991) 2013-02-28 12:09
https://issues.openbravo.com/file_download.php?file_id=6007&type=bug
Issue History
2012-12-12 10:30VictorVillarNew Issue
2012-12-12 10:30VictorVillarAssigned To => AugustoMauch
2012-12-12 10:30VictorVillarModules => Core
2012-12-12 10:30VictorVillarResolution time => 1360710000
2012-12-12 10:30VictorVillarTriggers an Emergency Pack => No
2012-12-12 10:30VictorVillarIssue Monitored: networkb
2012-12-19 18:27VictorVillarRelationship addedblocks 0022638
2013-01-29 18:42AugustoMauchAssigned ToAugustoMauch => shankarb
2013-01-31 15:27AugustoMauchStatusnew => feedback
2013-02-04 10:06shankarbNote Added: 0056117
2013-02-04 17:06VictorVillarStatusfeedback => scheduled
2013-02-04 17:06VictorVillarfix_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:35AugustoMauchAssigned Toshankarb => AugustoMauch
2013-02-28 11:59AugustoMauchFile Added: issue22523.export
2013-02-28 11:59AugustoMauchStatusacknowledged => scheduled
2013-02-28 11:59AugustoMauchfix_in_branch => pi
2013-02-28 12:04AugustoMauchNote Added: 0056832
2013-02-28 12:09AugustoMauchFile Added: org.openbravo.issue22523-1.0.0.obx
2013-02-28 12:26AugustoMauchNote Added: 0056834
2013-03-04 13:17jonalegriaesarteNote Added: 0057001
2013-03-04 13:17jonalegriaesarteTarget Version3.0MP21 => 3.0MP22
2013-03-04 13:17jonalegriaesartefix_in_branchpi =>
2013-03-07 12:53AugustoMauchIssue Monitored: marvintm
2013-03-07 12:53AugustoMauchReview Assigned To => marvintm
2013-03-07 12:54hgbotCheckin
2013-03-07 12:54hgbotNote Added: 0057132
2013-03-07 12:54hgbotStatusscheduled => resolved
2013-03-07 12:54hgbotResolutionopen => fixed
2013-03-07 12:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ad1497b9b8641d58cebafce70b58c88e675e86df [^]
2013-03-22 09:30marvintmStatusresolved => closed
2013-03-22 09:31marvintmFixed in Version => 3.0MP21
2013-03-22 09:33marvintmStatusclosed => new
2013-03-22 09:33marvintmResolutionfixed => open
2013-03-22 09:34marvintmFixed in Version3.0MP21 =>
2013-03-22 09:34marvintmStatusnew => scheduled
2013-03-22 09:34marvintmfix_in_branch => pi
2013-03-22 09:34marvintmStatusscheduled => resolved
2013-03-22 09:34marvintmResolutionopen => fixed
2013-03-22 09:35marvintmStatusresolved => closed
2013-03-22 09:35marvintmFixed in Version => 3.0MP22

Notes
(0056117)
shankarb   
2013-02-04 10:06   
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.
(0056832)
AugustoMauch   
2013-02-28 12:04   
A patch for this issue has been attached. It will not be pushed to pi yet because a change has been in a very central component and it must be tested carefully.
(0056834)
AugustoMauch   
2013-02-28 12:26   
Steps to reproduce:
- Install the obx that is attached to this issue. It contains a selector based on a view. Check the selector, it is called ProductBasedOnView, and its column field has been set to product, which is the entity whose id is used in the value field of the selector.
- Assign this selector to the Product column in the C_order table.
- Create a new Sales Order and check that it is possible to add lines the same way that using the old reference (a Search based on a view).
(0057001)
jonalegriaesarte   
2013-03-04 13:17   
Patch attached but, push will be included in MP22, because it has to be tested in depth
(0057132)
hgbot   
2013-03-07 12:54   
Repository: erp/devel/pi
Changeset: ad1497b9b8641d58cebafce70b58c88e675e86df
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Feb 28 11:58:13 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ad1497b9b8641d58cebafce70b58c88e675e86df [^]

Fixes issue 22523: It is possible to use a selector reference based on a view

The problem was that the referenced property of the column that used a selector reference based on a view was wrong. I.e. if a selector is created using the view m_product_price_warehouse_v, if the value field used is its product.id property, it would not be possible to save an order line using this selector because DAL would not be able to retrieve the product, it wo
uld try to fetch a record from the m_product_price_warehouse_v view using the product id, which is not the same as the view primary key.

To fix this, the user must set the column field of the defined selector so that it points to the entity used in the value field. A change has been done in SelectorDomainType.getForeignKeyColumn to ensure that this works with views.

---
M modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/model/domaintype/SelectorDomainType.java
---