Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033198Openbravo ERPC. Securitypublic2016-06-08 22:492016-06-24 22:11
rbianchini 
dmiguelez 
normalmajoralways
closedfixed 
5
3.0PR16Q1.3 
3.0PR16Q3 
aferraz
Core
No
0033198: Wrong Organization in treenode
When you create a new element value in an account tree, sometimes the organization associated to the elementvalue is not the same organization that is associated wit the treenode related to the element value.
This cause errors associated with the role's permissions.
1 - Log in the ERP and check (by clicking in the name) that the organization you are using is "F&B España - Región Norte"
2 - Go to "Account Tree" window
3 - Select the tree "F&B International Group Account Account
4 - Switch to "Element Value" tab and add a new element with name = 'Test' and a NUMERIC value for the search key, for example 10001
5 - Execute this query in the database:
Select e.c_elementvalue_id elementID, t.ad_treenode_id treenodeID, oe.name elementOrg, ot.name treenodeOrg
from c_elementvalue e join ad_org oe on e.ad_org_id = oe.ad_org_id
join ad_treenode t on t.node_id = e.c_elementvalue_id
join ad_org ot on ot.ad_org_id = t.ad_org_id
where e.name = 'test'
6 - Realize that elementOrg is F&B International Group (The Account tree's organization --> OK) and the
treenodeOrg is F&B España - Región Norte (The actual user's organization --> wrong, it should be the same as elementOrg)
The problem is on the following line[1]of the ElementValueEventHandler. At that point the TreeNode element is created with the current context organization using DAL.


[1] https://code.openbravo.com/erp/devel/pi/file/2ab287aa587c/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java#l119 [^]
No tags attached.
related to defect 0033166 closed alostale Role with access to one organization can edit all of them in Organization window 
related to defect 00318563.0PR16Q2 closed caristu It is not supported to have more than one "Tree and node image" record defined for same client 
diff issue33198.diff (877) 2016-06-24 08:18
https://issues.openbravo.com/file_download.php?file_id=9576&type=bug
Issue History
2016-06-08 22:49rbianchiniNew Issue
2016-06-08 22:49rbianchiniAssigned To => platform
2016-06-08 22:49rbianchiniModules => Core
2016-06-08 22:49rbianchiniResolution time => 1466650800
2016-06-08 22:49rbianchiniTriggers an Emergency Pack => No
2016-06-14 10:30alostaleRelationship addedrelated to 0033166
2016-06-14 10:37alostaleRelationship addedrelated to 0031856
2016-06-14 11:26alostaleNote Added: 0087241
2016-06-14 11:26alostaleStatusnew => feedback
2016-06-14 11:26alostaleAssigned Toplatform => rbianchini
2016-06-22 18:58rbianchiniNote Added: 0087837
2016-06-22 18:58rbianchiniAssigned Torbianchini => alostale
2016-06-22 18:58rbianchiniStatusfeedback => new
2016-06-23 19:28caristuResolution time1466650800 => 1466632800
2016-06-23 19:28caristuProposed Solution updated
2016-06-23 20:04caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12477#r12477
2016-06-24 08:18caristuFile Added: issue33198.diff
2016-06-24 08:20caristuNote Added: 0087866
2016-06-24 09:13caristuAssigned Toalostale => Triage Finance
2016-06-24 10:08aferrazAssigned ToTriage Finance => dmiguelez
2016-06-24 10:10hgbotCheckin
2016-06-24 10:10hgbotNote Added: 0087884
2016-06-24 10:10hgbotStatusnew => resolved
2016-06-24 10:10hgbotResolutionopen => fixed
2016-06-24 10:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/11ff29c65d0941580591db8a890b3ec475fa87b9 [^]
2016-06-24 10:11aferrazReview Assigned To => aferraz
2016-06-24 10:11aferrazNote Added: 0087885
2016-06-24 10:11aferrazStatusresolved => closed
2016-06-24 10:11aferrazFixed in Version => 3.0PR16Q3
2016-06-24 22:11hudsonbotCheckin
2016-06-24 22:11hudsonbotNote Added: 0087912

Notes
(0087241)
alostale   
2016-06-14 11:26   
Unable to reproduce following the reported steps to reproduce, tried in current pi and in PR16Q1.3.

Checking the code, ad_treenode record is inserted on c_elementvalue record insertion by c_elementvalue_trg trigger which sets the element value's organization.
(0087837)
rbianchini   
2016-06-22 18:58   
Hello alostale, I tried again, and with the given steps i was able to reproduce the problem. I don't think this data is relevant, but just in case, the value field was 123456789.
When you can, please contact with me if you can't reproduce the problem.

Regards
(0087866)
caristu   
2016-06-24 08:20   
Attached a patch with a proposed solution
(0087884)
hgbot   
2016-06-24 10:10   
Repository: erp/devel/pi
Changeset: 11ff29c65d0941580591db8a890b3ec475fa87b9
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Jun 24 09:51:38 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/11ff29c65d0941580591db8a890b3ec475fa87b9 [^]

Fixes issue 33198: Sets the account Organization in the Organization definition

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java
---
(0087885)
aferraz   
2016-06-24 10:11   
Code review + Testing OK
(0087912)
hudsonbot   
2016-06-24 22:11   
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/cc0900cf80c9 [^]
Maturity status: Test