[ADD] Scrum: Create sprint from backlog wizard => OSV memory
bzr revid: mra@tinyerp.com-20100430084026-qlw3ttpevjqz5mkk
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--<wizard id="wizard_scrum_backlog_task" model="scrum.product.backlog" name="scrum.product.backlog.task.create" string="Create Tasks"/>-->
|
||||
<wizard id="wizard_scrum_backlog_sprint" model="scrum.product.backlog" name="scrum.product.backlog.sprint.assign" string="Assign Sprint"/>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
# -*- 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', '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:
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# -*- 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_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:
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_scrum_backlog_to_sprint" model="ir.ui.view">
|
||||
<field name="name">backlog.assign.sprint.form</field>
|
||||
<field name="model">backlog.assign.sprint</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Assign Sprint">
|
||||
<group col="4" colspan="6">
|
||||
<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>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="assign_sprint" string="Assign Sprint" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_scrum_backlog_to_sprint" model="ir.actions.act_window">
|
||||
<field name="name">Assign Sprint</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">backlog.assign.sprint</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="scrum_backlog_to_sprint_values">
|
||||
<field name="model_id" ref="model_scrum_product_backlog" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Assign Sprint</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_scrum_backlog_to_sprint'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">scrum.product.backlog</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user