Merge lp:~openerp-dev/openobject-server/trunk-uninstall-tpa into lp:openobject-server

Proposed by Turkesh Patel (openERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/trunk-uninstall-tpa
Merge into: lp:openobject-server
Diff against target: 37 lines (+13/-3)
2 files modified
openerp/addons/base/ir/ir_actions.py (+7/-0)
openerp/addons/base/ir/ir_ui_menu.py (+6/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-uninstall-tpa
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+139634@code.launchpad.net

Description of the change

Improved code to remove module uninstallation issues.
=====================================================================================
--> remove ir.action.todo also related to the actions otherwise it will fire that TODO and will try to find that action. And whithout action TODO is useless.
--> Improved query to find constraints to be deleted.

To post a comment you must log in.
4676. By Turkesh Patel (openERP)

[IMP] improved code and comment.

4677. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4678. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4679. By Turkesh Patel (openERP)

[IMP] remove now not-required changes.

4680. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4681. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4682. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4683. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4684. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4685. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4686. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4687. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4688. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4689. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

4690. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4691. By Turkesh Patel (openERP)

[MRG] use try-except to avoid error after uninstallation of module in which we have set menu to load in context.

4692. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4693. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4694. By Turkesh Patel (openERP)

[IMP] improved code

4695. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4696. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4697. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

Unmerged revisions

4697. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

4696. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4695. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4694. By Turkesh Patel (openERP)

[IMP] improved code

4693. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4692. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4691. By Turkesh Patel (openERP)

[MRG] use try-except to avoid error after uninstallation of module in which we have set menu to load in context.

4690. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

4689. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-addons

4688. By Turkesh Patel (openERP)

[MRG] merge with lp:openobject-server

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/ir/ir_actions.py'
2--- openerp/addons/base/ir/ir_actions.py 2014-04-07 17:46:28 +0000
3+++ openerp/addons/base/ir/ir_actions.py 2014-04-25 10:58:25 +0000
4@@ -57,6 +57,13 @@
5 'usage': lambda *a: False,
6 }
7
8+ def unlink(self, cr, uid, ids, context=None):
9+ """unlink ir.action.todo which are related to actions which will be deleted.
10+ NOTE: ondelete cascade will not work on ir.actions.actions so we will need to do it manually."""
11+ todo_obj = self.pool.get('ir.actions.todo')
12+ todo_ids = todo_obj.search(cr, uid, [('action_id', 'in', ids)], context=context)
13+ todo_obj.unlink(cr, uid, todo_ids, context=context)
14+ return super(actions, self).unlink(cr, uid, ids, context=context)
15
16 class ir_actions_report_xml(osv.osv):
17
18
19=== modified file 'openerp/addons/base/ir/ir_ui_menu.py'
20--- openerp/addons/base/ir/ir_ui_menu.py 2013-10-06 13:24:24 +0000
21+++ openerp/addons/base/ir/ir_ui_menu.py 2014-04-25 10:58:25 +0000
22@@ -312,9 +312,12 @@
23 menu_ref = [menu_ref]
24 model_data_obj = self.pool.get('ir.model.data')
25 for menu_data in menu_ref:
26- model, id = model_data_obj.get_object_reference(cr, uid, menu_data.split('.')[0], menu_data.split('.')[1])
27- if (model == 'ir.ui.menu'):
28- menu_ids.add(id)
29+ try:
30+ model, id = model_data_obj.get_object_reference(cr, uid, menu_data.split('.')[0], menu_data.split('.')[1])
31+ if (model == 'ir.ui.menu'):
32+ menu_ids.add(id)
33+ except Exception:
34+ pass
35 menu_ids = list(menu_ids)
36
37 for menu in self.browse(cr, uid, menu_ids, context=context):