diff --git a/addons/scrum/__openerp__.py b/addons/scrum/__openerp__.py index 3ed40e68f9f..b2fb94682b7 100644 --- a/addons/scrum/__openerp__.py +++ b/addons/scrum/__openerp__.py @@ -52,10 +52,10 @@ 'update_xml': [ 'security/ir.model.access.csv', 'scrum_report.xml', - 'scrum_wizard.xml', 'scrum_view.xml', 'process/scrum_process.xml', - 'wizard/scrum_backlog_create_task_view.xml' + 'wizard/scrum_backlog_create_task_view.xml', + 'wizard/scrum_backlog_sprint_view.xml', ], 'demo_xml': ['scrum_demo.xml'], 'installable': True, diff --git a/addons/scrum/scrum_wizard.xml b/addons/scrum/scrum_wizard.xml deleted file mode 100644 index efb6da72edb..00000000000 --- a/addons/scrum/scrum_wizard.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/addons/scrum/wizard/__init__.py b/addons/scrum/wizard/__init__.py index c0943ededf9..6e0d739f889 100644 --- a/addons/scrum/wizard/__init__.py +++ b/addons/scrum/wizard/__init__.py @@ -20,7 +20,7 @@ ############################################################################## import scrum_backlog_create_task -import assign_backlog_to_sprint +import scrum_backlog_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 deleted file mode 100644 index fe36344976c..00000000000 --- a/addons/scrum/wizard/assign_backlog_to_sprint.py +++ /dev/null @@ -1,86 +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 . -# -############################################################################## - -import wizard -import ir -from mx.DateTime import now -import pooler -import netsvc - -bts_form = """ -
- - - - - - - - - - -""" - -bts_fields = { - 'sprint_id' : {'string':'Sprint Name', 'type':'many2one', 'relation':'scrum.sprint', 'required':True}, - 'state_open' : {'string':'Set Open', 'type':'boolean', 'default': lambda *a: True}, - 'convert_to_task' : {'string':'Convert To Task', 'type':'boolean', 'default': lambda *a: True} -} - -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'], context=context): - backlog_obj.write(cr, uid, backlog.id, {'sprint_id':data['form']['sprint_id']}, context=context) - 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': False, - 'planned_hours':backlog.planned_hours, - 'remaining_hours':backlog.expected_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: - diff --git a/addons/scrum/wizard/scrum_backlog_sprint.py b/addons/scrum/wizard/scrum_backlog_sprint.py new file mode 100644 index 00000000000..8125df1ba53 --- /dev/null +++ b/addons/scrum/wizard/scrum_backlog_sprint.py @@ -0,0 +1,62 @@ +# -*- 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 osv import osv, fields + +class backlog_sprint_assign(osv.osv_memory): + _name = 'backlog.assign.sprint' + _description = 'Assign sprint to backlogs' + _columns = { + 'sprint_id': fields.many2one('scrum.sprint', 'Sprint Name', required=True), + 'state_open': fields.boolean('Set Open', help="Change the state of product backlogs to open if its in draft state"), + 'convert_to_task': fields.boolean('Convert To Task', help="Create Task for Product Backlog") + } + _defaults = { + 'state_open': True, + 'convert_to_task': True, + } + + def assign_sprint(self, cr, uid, ids, context=None): + backlog_obj = self.pool.get('scrum.product.backlog') + task = self.pool.get('project.task') + backlog_ids = [] + if context is None: + context = {} + data = self.read(cr, uid, ids, [], context=context)[0] + for backlog in backlog_obj.browse(cr, uid, context['active_ids'], context=context): + backlog_ids.append(backlog.id) + if data['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': False, + 'planned_hours':backlog.planned_hours, + 'remaining_hours':backlog.expected_hours, + }) + if data['state_open'] and backlog.state == "draft": + backlog_obj.write(cr, uid, backlog.id, {'state':'open'}) + backlog_obj.write(cr, uid, backlog_ids, {'sprint_id': data['sprint_id']}, context=context) + return {} + +backlog_sprint_assign() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/scrum/wizard/scrum_backlog_sprint_view.xml b/addons/scrum/wizard/scrum_backlog_sprint_view.xml new file mode 100644 index 00000000000..20fedbb6978 --- /dev/null +++ b/addons/scrum/wizard/scrum_backlog_sprint_view.xml @@ -0,0 +1,49 @@ + + + + + + backlog.assign.sprint.form + backlog.assign.sprint + form + +
+ + + + + + + + + + + +