diff --git a/addons/crm_project/crm_bugs_view.xml b/addons/crm_project/crm_bugs_view.xml
index 8eeab9805e0..ac6b1a530de 100644
--- a/addons/crm_project/crm_bugs_view.xml
+++ b/addons/crm_project/crm_bugs_view.xml
@@ -38,18 +38,27 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -82,7 +91,7 @@
-
+
@@ -106,7 +115,7 @@
-
+
@@ -146,8 +155,7 @@
-
-
+
diff --git a/addons/crm_project/crm_project_bug.py b/addons/crm_project/crm_project_bug.py
index 14ec6f25a1e..ca6b93e9b88 100644
--- a/addons/crm_project/crm_project_bug.py
+++ b/addons/crm_project/crm_project_bug.py
@@ -69,14 +69,23 @@ class crm_project_bug(osv.osv):
user = self.pool.get('res.users').browse(cr,uid,uid, context=context)
if user.context_project_id:
return user.context_project_id
- return False
+ return False
+
+ def _convert(self, cr, uid, ids, xml_id, context=None):
+ data_obj = self.pool.get('ir.model.data')
+ id2 = data_obj._get_id(cr, uid, 'crm_project', xml_id)
+ categ_id = False
+ if id2:
+ categ_id = data_obj.browse(cr, uid, id2, context=context).res_id
+ if categ_id:
+ self.write(cr, uid, ids, {'categ_id': categ_id})
+ return True
def convert_to_feature(self, cr, uid, ids, context=None):
- categ_obj = self.pool.get('crm.case.categ')
- categ_id = categ_obj.search(cr, uid, [('name', 'ilike', 'feature%')])
- for id in ids:
- self.write(cr, uid, id, {'categ_id': categ_id and categ_id[0] or False})
- return True
+ return self._convert(cr, uid, ids, 'feature_request_categ', context=context)
+
+ def convert_to_bug(self, cr, uid, ids, context=None):
+ return self._convert(cr, uid, ids, 'bug_categ', context=context)
_defaults = {
'project_id':_get_project,