summaryrefslogtreecommitdiff
path: root/addons/project_scrum/wizard/project_scrum_backlog_create_task.py
diff options
context:
space:
mode:
authorpsi (Open ERP) <psi@tinyerp.co.in>2010-07-15 11:17:56 +0530
committerpsi (Open ERP) <psi@tinyerp.co.in>2010-07-15 11:17:56 +0530
commit27a3dc94188534ee7034d53b4e0f9c9b08f90ceb (patch)
treec80a5b3e4944a8a57cc4544df26300ada5a4dd26 /addons/project_scrum/wizard/project_scrum_backlog_create_task.py
parentf18f4398edcb1bfb13279abf8e4d17fe36ede0f5 (diff)
[IMP] scrum: Rename scrum to project_scrum and rename all the object accordinglly
bzr revid: psi@tinyerp.co.in-20100715054756-loyjd9bhda0xq125
Diffstat (limited to 'addons/project_scrum/wizard/project_scrum_backlog_create_task.py')
-rw-r--r--addons/project_scrum/wizard/project_scrum_backlog_create_task.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/addons/project_scrum/wizard/project_scrum_backlog_create_task.py b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py
new file mode 100644
index 00000000000..9fcf104211e
--- /dev/null
+++ b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from osv import osv, fields
+
+class backlog_create_task(osv.osv_memory):
+ _name = 'project.scrum.backlog.create.task'
+ _description = 'Create Tasks from Product Backlogs'
+ _columns = {
+ 'user_id': fields.many2one('res.users', 'Assign To')
+ }
+
+ def do_create(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ task = self.pool.get('project.task')
+ backlog_id = self.pool.get('project.scrum.product.backlog')
+ ids_task = []
+
+ if context is None:
+ context = {}
+ data = self.read(cr, uid, ids, [], context=context)[0]
+ backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context)
+ result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+
+ for backlog in backlogs:
+ ids_task.append(task.create(cr, uid, {
+ 'product_backlog_id': backlog.id,
+ 'name': backlog.name,
+ 'description': backlog.note,
+ 'project_id': backlog.project_id.id,
+ 'user_id': data['user_id'] or False,
+ 'planned_hours': backlog.expected_hours,
+ 'remaining_hours':backlog.expected_hours,
+ 'sequence':backlog.sequence,
+ }))
+
+ return {
+ 'domain': "[('product_backlog_id','in',["+','.join(map(str, context['active_ids']))+"])]",
+ 'name': 'Tasks',
+ 'res_id': ids_task,
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'project.task',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id'],
+ }
+
+backlog_create_task()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: