diff --git a/addons/project_issue/__init__.py b/addons/project_issue/__init__.py
index 4ee524bb479..c51b756f4ca 100644
--- a/addons/project_issue/__init__.py
+++ b/addons/project_issue/__init__.py
@@ -20,7 +20,6 @@
#
##############################################################################
-
import project_issue
import report
import wizard
diff --git a/addons/project_issue/__terp__.py b/addons/project_issue/__terp__.py
index 03ec9e22285..2bf67d47191 100644
--- a/addons/project_issue/__terp__.py
+++ b/addons/project_issue/__terp__.py
@@ -39,10 +39,8 @@
'project_issue_data.xml'
],
'update_xml': [
- 'project_issue_wizard.xml',
'project_issue_view.xml',
- 'project_issue_menu.xml',
- 'project_feature_menu.xml',
+ 'project_issue_menu.xml',
'report/project_issue_report_view.xml',
'security/project_issue_security.xml',
'security/ir.model.access.csv',
diff --git a/addons/project_issue/project_feature_menu.xml b/addons/project_issue/project_feature_menu.xml
deleted file mode 100644
index 1c757a73909..00000000000
--- a/addons/project_issue/project_feature_menu.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 1fb1c353bab..fa43de1ef2d 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -23,11 +23,11 @@ import base64
import os
import re
import time
-import time
-import tools
-from crm import crm
import mx.DateTime
from datetime import datetime, timedelta
+
+import tools
+from crm import crm
from osv import fields,osv,orm
from osv.orm import except_orm
from tools.translate import _
@@ -58,9 +58,9 @@ class project_issue(osv.osv):
@param ids: List of Openday’s IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
- """
- cal_obj = self.pool.get('resource.calendar')
- res_obj = self.pool.get('resource.resource')
+ """
+ cal_obj = self.pool.get('resource.calendar')
+ res_obj = self.pool.get('resource.resource')
res = {}
for issue in self.browse(cr, uid, ids , context):
@@ -88,7 +88,7 @@ class project_issue(osv.osv):
duration = float(ans.days)
if issue.section_id.resource_calendar_id:
- duration = float(ans.days) * 24
+ duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
issue.section_id.resource_calendar_id and issue.section_id.resource_calendar_id.id or False,
@@ -100,9 +100,9 @@ class project_issue(osv.osv):
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
- no_days.append(in_time.date)
+ no_days.append(in_time.date)
if out_time > date_until:
- break
+ break
duration = len(no_days)
res[issue.id][field] = abs(int(duration))
return res
@@ -140,6 +140,60 @@ class project_issue(osv.osv):
return user.context_project_id
return False
+ def convert_issue_task(self, cr, uid, ids, context=None):
+ case_obj = self.pool.get('project.issue')
+ data_obj = self.pool.get('ir.model.data')
+ task_obj = self.pool.get('project.task')
+
+ if context is None:
+ context = {}
+
+ for case in case_obj.browse(cr, uid, ids, context=context):
+ if case.state != 'open':
+ raise osv.except_osv(_('Warning !'),
+ _('Issues or Feature Requests should be in \'Open\' state before converting into Task.'))
+
+ result = data_obj._get_id(cr, uid, 'project', 'view_task_search_form')
+ res = data_obj.read(cr, uid, result, ['res_id'])
+ id2 = data_obj._get_id(cr, uid, 'project', 'view_task_form2')
+ id3 = data_obj._get_id(cr, uid, 'project', 'view_task_tree2')
+ if id2:
+ id2 = data_obj.browse(cr, uid, id2, context=context).res_id
+ if id3:
+ id3 = data_obj.browse(cr, uid, id3, context=context).res_id
+
+ for bug in case_obj.browse(cr, uid, ids, context=context):
+ new_task_id = task_obj.create(cr, uid, {
+ 'name': bug.name,
+ 'partner_id': bug.partner_id.id,
+ 'description':bug.description,
+ 'date': bug.date,
+ 'project_id':bug.project_id.id,
+ 'priority':bug.priority,
+ 'user_id':bug.user_id.id,
+ 'planned_hours': 0.0,
+ })
+
+ new_task = task_obj.browse(cr, uid, new_task_id)
+
+ vals = {
+ 'task_id': new_task_id,
+ }
+ case_obj.write(cr, uid, [bug.id], vals)
+
+ return {
+ 'name': _('Tasks'),
+ 'view_type': 'form',
+ 'view_mode': 'form,tree',
+ 'res_model': 'project.task',
+ 'res_id': int(new_task_id),
+ 'view_id': False,
+ 'views': [(id2,'form'),(id3,'tree'),(False,'calendar'),(False,'graph')],
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': res['res_id'],
+ 'nodestroy': True
+ }
+
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, 'project_issue', xml_id)
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index b9c0573ea57..95892af9ce7 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -54,8 +54,8 @@
diff --git a/addons/project_issue/project_issue_wizard.xml b/addons/project_issue/project_issue_wizard.xml
deleted file mode 100644
index 16e54da49d7..00000000000
--- a/addons/project_issue/project_issue_wizard.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
diff --git a/addons/project_issue/wizard/__init__.py b/addons/project_issue/wizard/__init__.py
deleted file mode 100644
index 3ae599d66c3..00000000000
--- a/addons/project_issue/wizard/__init__.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (). All Rights Reserved
-# $Id$
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-
-import project_issue_wizard
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_issue/wizard/project_issue_wizard.py b/addons/project_issue/wizard/project_issue_wizard.py
deleted file mode 100644
index 4aef1529619..00000000000
--- a/addons/project_issue/wizard/project_issue_wizard.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from mx.DateTime import now
-
-import wizard
-import netsvc
-import ir
-import pooler
-from tools.translate import _
-
-class issue2task(wizard.interface):
-
- def _check_state(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- case_obj = pool.get('project.issue')
- for case in case_obj.browse(cr, uid, data['ids']):
- if case.state != 'open':
- raise wizard.except_wizard(_('Warning !'),
- _('Issues or Feature Requests should be in \'Open\' state before converting into Task.'))
- return {}
-
- def _makeTask(self, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- data_obj = pool.get('ir.model.data')
- result = data_obj._get_id(cr, uid, 'project', 'view_task_search_form')
- res = data_obj.read(cr, uid, result, ['res_id'])
-
-
- id2 = data_obj._get_id(cr, uid, 'project', 'view_task_form2')
- id3 = data_obj._get_id(cr, uid, 'project', 'view_task_tree2')
- if id2:
- id2 = data_obj.browse(cr, uid, id2, context=context).res_id
- if id3:
- id3 = data_obj.browse(cr, uid, id3, context=context).res_id
-
- bug_case_obj = pool.get('project.issue')
- task_obj = pool.get('project.task')
- for bug in bug_case_obj.browse(cr, uid, data['ids']):
- new_task_id = task_obj.create(cr, uid, {
- 'name': bug.name,
- 'partner_id': bug.partner_id.id,
- 'description':bug.description,
- 'date': bug.date,
- 'project_id':bug.project_id.id,
- 'priority':bug.priority,
- 'user_id':bug.user_id.id,
- 'planned_hours': 0.0,
- })
-
- new_task = task_obj.browse(cr, uid, new_task_id)
-
- vals = {
- 'task_id': new_task_id,
- }
-
- bug_case_obj.write(cr, uid, [bug.id], vals)
-
- value = {
- 'name': _('Tasks'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'res_model': 'project.task',
- 'res_id': int(new_task_id),
- 'view_id': False,
- 'views': [(id2,'form'),(id3,'tree'),(False,'calendar'),(False,'graph')],
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
- return value
-
- states = {
- 'init': {
- 'actions': [_check_state],
- 'result': {'type': 'action', 'action': _makeTask, 'state':'end' }
- }
- }
-
-issue2task('project.issue.task_set')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: