[IMP] project_scrum: useability
bzr revid: hmo@tinyerp.com-20100827150444-ief8spc1du4ol5m9
This commit is contained in:
parent
5247699a18
commit
beff746c24
|
@ -45,49 +45,29 @@ class project_scrum_sprint(osv.osv):
|
|||
_name = 'project.scrum.sprint'
|
||||
_description = 'Project Scrum Sprint'
|
||||
|
||||
def _calc_progress(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
def _compute(self, cr, uid, ids, fields, arg, context=None):
|
||||
res = {}.fromkeys(ids, 0.0)
|
||||
progress = {}
|
||||
if not ids:
|
||||
return res
|
||||
if context is None:
|
||||
context = {}
|
||||
for sprint in self.browse(cr, uid, ids):
|
||||
for sprint in self.browse(cr, uid, ids, context=context):
|
||||
tot = 0.0
|
||||
prog = 0.0
|
||||
effective = 0.0
|
||||
progress = 0.0
|
||||
for bl in sprint.backlog_ids:
|
||||
tot += bl.expected_hours
|
||||
effective += bl.effective_hours
|
||||
prog += bl.expected_hours * bl.progress / 100.0
|
||||
res.setdefault(sprint.id, 0.0)
|
||||
if tot>0:
|
||||
res[sprint.id] = round(prog/tot*100)
|
||||
return res
|
||||
|
||||
def _calc_effective(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for sprint in self.browse(cr, uid, ids):
|
||||
res.setdefault(sprint.id, 0.0)
|
||||
for bl in sprint.backlog_ids:
|
||||
res[sprint.id] += bl.effective_hours
|
||||
return res
|
||||
|
||||
def _calc_planned(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for sprint in self.browse(cr, uid, ids):
|
||||
res.setdefault(sprint.id, 0.0)
|
||||
for bl in sprint.backlog_ids:
|
||||
res[sprint.id] += bl.expected_hours
|
||||
return res
|
||||
|
||||
def _calc_expected(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for sprint in self.browse(cr, uid, ids):
|
||||
res.setdefault(sprint.id, 0.0)
|
||||
for bl in sprint.backlog_ids:
|
||||
res[sprint.id] += bl.expected_hours
|
||||
progress = round(prog/tot*100)
|
||||
res[sprint.id] = {
|
||||
'progress' : progress,
|
||||
'expected_hours' : tot,
|
||||
'effective_hours': effective,
|
||||
}
|
||||
return res
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
|
@ -137,9 +117,9 @@ class project_scrum_sprint(osv.osv):
|
|||
'review': fields.text('Sprint Review'),
|
||||
'retrospective': fields.text('Sprint Retrospective'),
|
||||
'backlog_ids': fields.one2many('project.scrum.product.backlog', 'sprint_id', 'Sprint Backlog'),
|
||||
'progress': fields.function(_calc_progress, method=True, string='Progress (0-100)', help="Computed as: Time Spent / Total Time."),
|
||||
'effective_hours': fields.function(_calc_effective, method=True, string='Effective hours', help="Computed using the sum of the task work done."),
|
||||
'expected_hours': fields.function(_calc_expected, method=True, string='Planned Hours', help='Estimated time to do the task.'),
|
||||
'progress': fields.function(_compute, group_operator="avg", type='float', multi="progress", method=True, string='Progress (0-100)', help="Computed as: Time Spent / Total Time."),
|
||||
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Effective hours', help="Computed using the sum of the task work done."),
|
||||
'expected_hours': fields.function(_compute, multi="expected_hours", method=True, string='Planned Hours', help='Estimated time to do the task.'),
|
||||
'state': fields.selection([('draft','Draft'),('open','Open'),('pending','Pending'),('cancel','Cancelled'),('done','Done')], 'State', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -188,39 +168,31 @@ class project_scrum_product_backlog(osv.osv):
|
|||
return self.name_get(cr, uid, ids, context=context)
|
||||
return super(project_scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
|
||||
|
||||
def _calc_progress(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
def _compute(self, cr, uid, ids, fields, arg, context=None):
|
||||
res = {}.fromkeys(ids, 0.0)
|
||||
progress = {}
|
||||
if not ids:
|
||||
return res
|
||||
if context is None:
|
||||
context = {}
|
||||
for bl in self.browse(cr, uid, ids):
|
||||
for backlog in self.browse(cr, uid, ids, context=context):
|
||||
tot = 0.0
|
||||
prog = 0.0
|
||||
for task in bl.tasks_id:
|
||||
effective = 0.0
|
||||
task_hours = 0.0
|
||||
progress = 0.0
|
||||
for task in backlog.tasks_id:
|
||||
task_hours += task.total_hours
|
||||
effective += task.effective_hours
|
||||
tot += task.planned_hours
|
||||
prog += task.planned_hours * task.progress / 100.0
|
||||
res.setdefault(bl.id, 0.0)
|
||||
if tot>0:
|
||||
res[bl.id] = round(prog/tot*100)
|
||||
return res
|
||||
|
||||
def _calc_effective(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for bl in self.browse(cr, uid, ids):
|
||||
res.setdefault(bl.id, 0.0)
|
||||
for task in bl.tasks_id:
|
||||
res[bl.id] += task.effective_hours
|
||||
return res
|
||||
|
||||
def _calc_task(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for bl in self.browse(cr, uid, ids):
|
||||
res.setdefault(bl.id, 0.0)
|
||||
for task in bl.tasks_id:
|
||||
res[bl.id] += task.total_hours
|
||||
progress = round(prog/tot*100)
|
||||
res[backlog.id] = {
|
||||
'progress' : progress,
|
||||
'effective_hours': effective,
|
||||
'task_hours' : task_hours
|
||||
}
|
||||
return res
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
|
@ -291,11 +263,11 @@ class project_scrum_product_backlog(osv.osv):
|
|||
'sequence' : fields.integer('Sequence', help="Gives the sequence order when displaying a list of product backlog."),
|
||||
'tasks_id': fields.one2many('project.task', 'product_backlog_id', 'Tasks Details'),
|
||||
'state': fields.selection([('draft','Draft'),('open','Open'),('pending','Pending'),('done','Done'),('cancel','Cancelled')], 'State', required=True),
|
||||
'progress': fields.function(_calc_progress, method=True, string='Progress', help="Computed as: Time Spent / Total Time."),
|
||||
'effective_hours': fields.function(_calc_effective, method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks"),
|
||||
'progress': fields.function(_compute, multi="progress", group_operator="avg", type='float', method=True, string='Progress', help="Computed as: Time Spent / Total Time."),
|
||||
'effective_hours': fields.function(_compute, multi="effective_hours", method=True, string='Spent Hours', help="Computed using the sum of the time spent on every related tasks"),
|
||||
'expected_hours': fields.float('Planned Hours', help='Estimated total time to do the Backlog'),
|
||||
'create_date': fields.datetime("Creation Date", readonly=True),
|
||||
'task_hours': fields.function(_calc_task, method=True, string='Task Hours', help='Estimated time of the total hours of the tasks')
|
||||
'task_hours': fields.function(_compute, multi="task_hours", method=True, string='Task Hours', help='Estimated time of the total hours of the tasks')
|
||||
}
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
|
|
|
@ -24,7 +24,7 @@ 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')
|
||||
'user_id': fields.many2one('res.users', 'Assign To', help="Resposible user who can work on task")
|
||||
}
|
||||
|
||||
def do_create(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -7,21 +7,22 @@
|
|||
<field name="model">project.scrum.backlog.create.task</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Tasks">
|
||||
<group col="4" colspan="6">
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<form string="Convert into Tasks">
|
||||
<separator string="Convert into Tasks" colspan="4"/>
|
||||
<field name="user_id"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Close" icon='gtk-close'/>
|
||||
<button name="do_create" string="Create Tasks" colspan="1" type="object" icon="gtk-execute"/>
|
||||
<group col="2" colspan="2">
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<button special="cancel" string="_Close" icon='gtk-close'/>
|
||||
<button name="do_create" string="Co_nvert" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_scrum_backlog_to_task" model="ir.actions.act_window">
|
||||
<field name="name">Create Tasks</field>
|
||||
<field name="name">Convert into Tasks</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">project.scrum.backlog.create.task</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -32,7 +33,7 @@
|
|||
<record model="ir.values" id="scrum_backlog_to_task_values">
|
||||
<field name="model_id" ref="model_project_scrum_product_backlog" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Create Tasks</field>
|
||||
<field name="name">Convert into Tasks</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_scrum_backlog_to_task'))" />
|
||||
<field name="key">action</field>
|
||||
|
|
|
@ -25,8 +25,8 @@ class backlog_sprint_assign(osv.osv_memory):
|
|||
_name = 'project.scrum.backlog.assign.sprint'
|
||||
_description = 'Assign sprint to backlogs'
|
||||
_columns = {
|
||||
'sprint_id': fields.many2one('project.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"),
|
||||
'sprint_id': fields.many2one('project.scrum.sprint', 'Sprint', required=True, help="Select Sprint to assign backlog."),
|
||||
'state_open': fields.boolean('Open Backlog', 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 = {
|
||||
|
|
|
@ -8,20 +8,16 @@
|
|||
<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 string="Assign Sprint" colspan="4"/>
|
||||
<field name="sprint_id" colspan="4"/>
|
||||
<field name="state_open" />
|
||||
<field name="convert_to_task"/>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Close" icon='gtk-close'/>
|
||||
<button name="assign_sprint" string="Assign Sprint" colspan="1" type="object" icon="gtk-execute"/>
|
||||
<group col="2" colspan="2">
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<button special="cancel" string="_Close" icon='gtk-close'/>
|
||||
<button name="assign_sprint" string="_Assign" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -47,4 +43,4 @@
|
|||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue