Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027148Openbravo ERPA. Platformpublic2014-07-22 11:322014-08-08 18:53
shuehner 
alostale 
normalmajorhave not tried
closedfixed 
5
 
3.0PR14Q4 
shankarb
Core
No
0027148: Module org.openbravo.module.resources cannot be uninstalled
At least in some cases that module is uninstallable.

This shows itself when having a db with that module used, then deleting the module folder and running update.database.
It fails with a fk-violation of an ad_tree entry pointing to a ad_table (obre_resource_category, B47E504D23D549A5A9CD9A9A426D20AF) shipped in that module.

As the ad_tree.ad_table-id fk is not defined as onDelete cascade this tree is not deleted and the module uninstall fails (note: only if some ad_tree entries to point to an ad_table of that module, not sure if that always is the case, but observed in at least 1 customer install).

However fixing that is not enough as the ad_tree pointing to that table are referenced from ad_clientinfo.AD_TREE_OBRE_RESOURCE_CATEGORY field.
Note those entries in ad_tree being referenced are auto-creaed by a modulescript.

Talking to vma he said that this field in ad_clientinfo is not used at all in core but only by this module. However it had to be added to core back then for technical reason.
Based on that it is find to add onDelete="setnull" to this field.

The combination of those 2 changes lets an update.db run suceed without error.
Take pigrape1207 db available from shu
Combine it with sources of PR14Q2.4 + RR14Q2.1
run update.database

Maybe also reproducible by taking pi + installing that module
Then verifying that the auto-created ad_tree entries point to some ad_table in that module and that they are referenced by ad_clientinfo.

Having that fullfilled should be enough to trigger the uninstallation problem.
- Add onDelete="cascade" to fk-definition in ad_tree pointing to ad_table
- Add onDelete="setnull" to fk-definition in ad_clientinfo of field AD_TREE_OBRE_RESOURCE_CATEGORY pointin to ad_tree
No tags attached.
related to feature request 00224033.0MP18 closed vmromanos Add support for Resource Category tree 
related to feature request 00259063.0PR14Q2 closed AugustoMauch Tree Extension Project 
related to defect 00271523.0PR14Q4 closed alostale can't export to dataset tree nodes defined in new trees 
Issue History
2014-07-22 11:32shuehnerNew Issue
2014-07-22 11:32shuehnerAssigned To => AugustoMauch
2014-07-22 11:32shuehnerModules => Core
2014-07-22 11:32shuehnerTriggers an Emergency Pack => No
2014-07-22 11:33shuehnerProposed Solution updated
2014-07-22 11:34shuehnerRelationship addedrelated to 0022403
2014-07-22 11:35shuehnerRelationship addedrelated to 0025906
2014-07-22 11:50alostaleAssigned ToAugustoMauch => alostale
2014-07-22 12:14alostaleNote Added: 0068792
2014-07-22 12:30alostaleReview Assigned To => shankarb
2014-07-22 12:31hgbotCheckin
2014-07-22 12:31hgbotNote Added: 0068795
2014-07-22 12:31hgbotStatusnew => resolved
2014-07-22 12:31hgbotResolutionopen => fixed
2014-07-22 12:31hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/a1bf5514b4218cf4a36c0353ff6e59f0c0e346aa [^]
2014-07-22 12:39alostaleRelationship addedrelated to 0027152
2014-07-31 06:31shankarbNote Added: 0068994
2014-07-31 06:31shankarbStatusresolved => closed
2014-07-31 06:31shankarbFixed in Version => 3.0PR14Q4
2014-08-08 18:53hudsonbotCheckin
2014-08-08 18:53hudsonbotNote Added: 0069207

Notes
(0068792)
alostale   
2014-07-22 12:14   
It can be reproduced by installing org.openbravo.module.resources and its org.openbravo.portal.member.roles dependency in a fresh pi
(0068795)
hgbot   
2014-07-22 12:31   
Repository: erp/devel/pi
Changeset: a1bf5514b4218cf4a36c0353ff6e59f0c0e346aa
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Jul 22 12:29:37 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a1bf5514b4218cf4a36c0353ff6e59f0c0e346aa [^]

fixed bug 27148: can't uninstall modules defining tree tables

---
M src-db/database/model/tables/AD_CLIENTINFO.xml
M src-db/database/model/tables/AD_TREE.xml
---
(0068994)
shankarb   
2014-07-31 06:31   
Code reviewed and verified in pi changeset be933e11432c.
(0069207)
hudsonbot   
2014-08-08 18:53   
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/4450016dee64 [^]
Maturity status: Test