Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0023334Openbravo ERPA. Platformpublic2013-03-18 20:002013-03-20 10:46
dmiguelez 
AugustoMauch 
urgentmajoralways
closedfixed 
20Community Appliance
 
3.0MP223.0MP22 
shankarb
Core
No
0023334: In Product Selector, when using the @ad_org_id@ in the HQL Where Clause is not working as expected.
In Product Selector, when using the @ad_org_id@ in the HQL Where Clause it uses the Organization of the session, not the Organization of the Document selected, even if it is stored in session.
In the Issue

https://issues.openbravo.com/view.php?id=23096 [^]

Use the proposed solution to fix it and realize that is not working as expected.
Is filtering the data using the Organization of the Session instead of the Organization of the Document.
No tags attached.
blocks defect 00230963.0MP22 closed dmiguelez Product selector Is not filtering by role org access 
Issue History
2013-03-18 20:00dmiguelezNew Issue
2013-03-18 20:00dmiguelezAssigned To => AugustoMauch
2013-03-18 20:00dmiguelezModules => Core
2013-03-18 20:00dmiguelezTriggers an Emergency Pack => No
2013-03-18 20:01dmiguelezTarget Version => 3.0MP22
2013-03-18 20:01dmiguelezRelationship addedblocks 0023096
2013-03-19 13:55AugustoMauchIssue Monitored: shankarb
2013-03-19 13:56AugustoMauchReview Assigned To => shankarb
2013-03-19 14:08hgbotCheckin
2013-03-19 14:08hgbotNote Added: 0057311
2013-03-19 14:08hgbotStatusnew => resolved
2013-03-19 14:08hgbotResolutionopen => fixed
2013-03-19 14:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1e02aa6032df035fc5bc481f4c2b989f485f8936 [^]
2013-03-19 16:37AugustoMauchNote Added: 0057313
2013-03-20 10:46shankarbNote Added: 0057322
2013-03-20 10:46shankarbStatusresolved => closed
2013-03-20 10:46shankarbFixed in Version => 3.0MP22

Notes
(0057311)
hgbot   
2013-03-19 14:08   
Repository: erp/devel/pi
Changeset: 1e02aa6032df035fc5bc481f4c2b989f485f8936
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Mar 19 14:06:21 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1e02aa6032df035fc5bc481f4c2b989f485f8936 [^]

Fixes issue 23334: Product selector fetched the proper value of @ad_org_id@

The problem was that the product selector did not send the windowId to the datasource. If there is no windowId, the datasource does not try to fetch the session variable from the window, as it should. In this particular case the selector should try to fetch the ad_org_id associated to the window, but instead is fetching the ad_org_id of the organization the user is logged with.

Selectors are not only used in generated windows but also in parameter windows. In that case it will not be possible to send to the datasource any windowId, but the process should not fail either.

---
M modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
---
(0057313)
AugustoMauch   
2013-03-19 16:37   
Test plan:

As System Administrator:
- Enter this in the HQL Where Clause of the Defined Selector tab of the Product selector: e.active='Y' and (AD_ISORGINCLUDED(e.warehouse.organization.id, @AD_Org_Id@, @AD_Client_Id@)<>-1 or (AD_ISORGINCLUDED( @AD_Org_Id@, e.warehouse.organization.id, @AD_Client_Id@)<>-1)).

As F&B Administrator
- Open the Sales Order window
- Create a new header, organization F&B EspaƱa, S.A.
- Create a new line in form view. Open the product selector window.
- Clear the filter. Only warehouses from Spain should be shown.

- Create a new header, organization F&B US, Inc.
- Create a new line in form view. Open the product selector window.
- Clear the filter. Only warehouses from US should be shown.

Before the fix, the warehouses shown in the product selector did not depend on the organization of the document, but on the organization the user is logged in.
(0057322)
shankarb   
2013-03-20 10:46   
Code reviewed and tested in pi changeset 6cfd12f52b4f