diff options
| author | PAP(OpenERP) <> | 2010-02-26 19:12:56 +0530 |
|---|---|---|
| committer | HDA (OpenERP) <hda@tinyerp.com> | 2010-02-26 19:12:56 +0530 |
| commit | 9f2cbf6bf9ec04a3d26829d00a661efc0233dba1 (patch) | |
| tree | 323b41049a085294823c694a250cdfecd6e320f4 /addons/scrum/wizard | |
| parent | 3f969c76a6fa4c374df6e67eda0f736af4c00a15 (diff) | |
Added demo data in long term and wizard to assign sprint on backlog
bzr revid: hda@tinyerp.com-20100226134256-p1ussmgt8llq566z
Diffstat (limited to 'addons/scrum/wizard')
| -rw-r--r-- | addons/scrum/wizard/__init__.py | 1 | ||||
| -rw-r--r-- | addons/scrum/wizard/assign_backlog_to_sprint.py | 87 |
2 files changed, 88 insertions, 0 deletions
diff --git a/addons/scrum/wizard/__init__.py b/addons/scrum/wizard/__init__.py index 3dcc246290a..117e64dcea7 100644 --- a/addons/scrum/wizard/__init__.py +++ b/addons/scrum/wizard/__init__.py @@ -20,6 +20,7 @@ ############################################################################## import backlog_to_task +import assign_backlog_to_sprint # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/scrum/wizard/assign_backlog_to_sprint.py b/addons/scrum/wizard/assign_backlog_to_sprint.py new file mode 100644 index 00000000000..35c2852325b --- /dev/null +++ b/addons/scrum/wizard/assign_backlog_to_sprint.py @@ -0,0 +1,87 @@ +# -*- 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/>. +# +############################################################################## + +import wizard +import ir +from mx.DateTime import now +import pooler +import netsvc + +bts_form = """<?xml version="1.0" ?> +<form string="Assign Sprint"> + <group> + <field name="sprint_id" colspan="2"/> + </group> + <newline/> + <separator colspan="2"/> + <newline/> + <group> + <field name="state_open" colspan="1"/> + <field name="convert_to_task" colspan="1"/> + </group> +</form>""" + +bts_fields = { + 'sprint_id' : {'string':'Sprint Name', 'type':'many2one', 'relation':'scrum.sprint', 'required':True}, + 'state_open' : {'string':'Set Open', 'type':'boolean'}, + 'convert_to_task' : {'string':'Convert To Task', 'type':'boolean'} +} + +def _assign_sprint(self, cr, uid, data, context): + pool = pooler.get_pool(cr.dbname) + backlog_obj = pool.get('scrum.product.backlog') + task = pool.get('project.task') + + state_open=data['form']['state_open'] + convert_to_task = data['form']['convert_to_task'] + + for backlog in backlog_obj.browse(cr, uid, data['ids']): + backlog_obj.write(cr, uid, backlog.id, {'sprint_id':data['form']['sprint_id']}) + if convert_to_task: + task.create(cr, uid, { + 'product_backlog_id': backlog.id, + 'name': backlog.name, + 'description': backlog.note, + 'project_id': backlog.project_id.id, + 'user_id': (backlog.user_id and backlog.user_id.id) or uid, + 'planned_hours': backlog.planned_hours + }) + if state_open: + if backlog.state == "draft": + backlog_obj.write(cr, uid, backlog.id, {'state':'open'}) + return {} + +class wiz_bts(wizard.interface): + states = { + 'init':{ + 'actions': [], + 'result': {'type':'form', 'arch':bts_form, 'fields':bts_fields, 'state':[('end', 'Cancel'), ('assign', 'Assign Sprint')] }, + }, + 'assign':{ + 'actions': [], + 'result': {'type':'action', 'action': _assign_sprint, 'state':'end'}, + }, + } +wiz_bts('scrum.product.backlog.sprint.assign') + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + |
