[MERGE] merge sbh branch for scrum changes

[IMP] clean code

bzr revid: mra@mra-laptop-20100608090104-tyylowctz8ylyn90
This commit is contained in:
Mustufa Rangwala
2010-06-08 14:31:04 +05:30
4 changed files with 146 additions and 22 deletions
+60 -12
View File
@@ -19,11 +19,13 @@
#
##############################################################################
import time
import netsvc
from osv import fields, osv, orm
from mx import DateTime
import netsvc
from osv import fields, osv, orm
import re
import tools
from tools.translate import _
class scrum_project(osv.osv):
_inherit = 'project.project'
@@ -49,8 +51,8 @@ class scrum_sprint(osv.osv):
tot = 0.0
prog = 0.0
for bl in sprint.backlog_ids:
tot += bl.planned_hours
prog += bl.planned_hours * bl.progress / 100.0
tot += bl.expected_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)
@@ -69,7 +71,7 @@ class scrum_sprint(osv.osv):
for sprint in self.browse(cr, uid, ids):
res.setdefault(sprint.id, 0.0)
for bl in sprint.backlog_ids:
res[sprint.id] += bl.planned_hours
res[sprint.id] += bl.expected_hours
return res
def _calc_expected(self, cr, uid, ids, name, args, context):
@@ -106,15 +108,14 @@ class scrum_sprint(osv.osv):
'date_stop': fields.date('Ending Date', required=True),
'project_id': fields.many2one('project.project', 'Project', required=True, domain=[('scrum','=',1)], help="If you have [?] in the project name, it means there are no analytic account linked to this project."),
'product_owner_id': fields.many2one('res.users', 'Product Owner', required=True,help="The person who is responsible for the product"),
'scrum_master_id': fields.many2one('res.users', 'Scrum Manager', required=True),
'scrum_master_id': fields.many2one('res.users', 'Scrum Manager', required=True,help="The person who is maintains the processes for the product"),
'meeting_ids': fields.one2many('scrum.meeting', 'sprint_id', 'Daily Scrum'),
'review': fields.text('Sprint Review'),
'retrospective': fields.text('Sprint Retrospective'),
'backlog_ids': fields.one2many('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."),
'planned_hours': fields.function(_calc_planned, method=True, string='Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'),
'expected_hours': fields.function(_calc_expected, method=True, string='Expected Hours', help='Estimated time to do the task.'),
'expected_hours': fields.function(_calc_expected, 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 = {
@@ -184,7 +185,7 @@ class scrum_product_backlog(osv.osv):
res[bl.id] += task.effective_hours
return res
def _calc_planned(self, cr, uid, ids, name, args, context):
def _calc_task(self, cr, uid, ids, name, args, context):
res = {}
for bl in self.browse(cr, uid, ids):
res.setdefault(bl.id, 0.0)
@@ -216,6 +217,21 @@ class scrum_product_backlog(osv.osv):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
return True
def button_postpone(self, cr, uid, ids, context=None):
for product in self.browse(cr, uid, ids, context=context):
tasks_id = []
for task in product.tasks_id:
if task.state != 'done':
tasks_id.append(task.id)
clone_id = self.copy(cr, uid, product.id, {
'name': 'PARTIAL:'+ product.name ,
'sprint_id':False,
'tasks_id':[(6, 0, tasks_id)],
})
self.write(cr, uid, ids, {'state':'cancel'}, context=context)
return True
_columns = {
'name' : fields.char('Feature', size=64, required=True),
'note' : fields.text('Note'),
@@ -228,9 +244,9 @@ class scrum_product_backlog(osv.osv):
'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='Effective hours', help="Computed using the sum of the task work done (Time spent on tasks)"),
'planned_hours': fields.function(_calc_planned, method=True, string='Planned Hours', help='Estimated time to do the task, usually set by the project manager when the task is in draft state.'),
'expected_hours': fields.float('Expected Hours', help='Estimated total time to do the Backlog'),
'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')
}
_defaults = {
'state': 'draft',
@@ -287,5 +303,37 @@ class scrum_meeting(osv.osv):
_defaults = {
'date' : time.strftime('%Y-%m-%d'),
}
def button_send_to_master(self, cr, uid, ids, context=None):
meeting_id = self.browse(cr, uid, ids)[0]
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email:
self.email_send(cr, uid, ids, email)
else:
raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.'))
return True
def button_send_product_owner(self, cr, uid, ids, context=None):
meeting_id = self.browse(cr, uid, ids)[0]
if meeting_id.sprint_id.product_owner_id.user_email:
self.email_send(cr,uid,ids,email)
else:
raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.'))
return True
def email_send(self, cr, uid, ids, email, context=None):
email_from = tools.config.get('email_from', False)
meeting_id = self.browse(cr,uid,ids)[0]
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
user_email = email_from or user.address_id.email or email_from
body = "Hello " + meeting_id.sprint_id.scrum_master_id.name+",\n" +" \nI am sending you Daily Meeting Details of date %s for the Sprint %s \n" % (meeting_id.date, meeting_id.sprint_id.name)
body += '\n*Tasks since yesterday: \n_______________________%s' % (meeting_id.question_yesterday) + '\n*Task for Today :\n_______________________ %s\n' % (meeting_id.question_today )+ '\n*Blocks encountered: \n_______________________ %s' % (meeting_id.question_blocks or 'No Blocks')
body += "\n\nThank you,\n"+ user.name
sub_name = meeting_id.name or 'Scrum Meeting of %s '%meeting_id.date
flag = tools.email_send(user_email , [email], sub_name, body, reply_to=None, openobject_id=str(meeting_id.id))
if not flag:
raise osv.except_osv(_('Error !'), _(' Email Not send to %s!' % meeting_id.sprint_id.product_owner_id.name))
return True
scrum_meeting()
+75 -4
View File
@@ -8,7 +8,7 @@
<!-- FIXME !!! -->
<field name="tasks">[24, 25, 28, 26, 27, 29, 30, 31, 32, 33, 34, 35, 37, 36, 38]</field>
<field model="res.users" name="manager" search="[('login','=','demo')]"/>
<field name="planned_hours">156.0</field>
<field name="expected_hours">156.0</field>
<field name="name">Open ERP - dev branch</field>
<field model="res.users" name="product_owner_id" search="[('login','=','demo')]"/>
</record>
@@ -32,6 +32,7 @@
<field name="expected_hours">6.0</field>
<field name="note">This new system will enable you to migrate automatically from an old version of Open ERP to a new one. This system will migrate not only the Open ERP system but also the customers particularities. This happens without any kind of script or programming. It has been possible to carry out such a system thanks to the descriptive approach of Open ERP components. </field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">done</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_1" model="scrum.product.backlog">
@@ -40,6 +41,7 @@
<field name="expected_hours">111.0</field>
<field name="note">The accounting module of Open ERP (financial accounting and management accounting) is being reshaped. New functionnalities will be added: intangible assets, a new way of presenting ledgers and bookings, new stock valuation calculation, and lots of predefined reports. </field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">open</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_2" model="scrum.product.backlog">
@@ -48,18 +50,21 @@
<field name="expected_hours">4.0</field>
<field name="note">We have to develop a plug-in system which will enable to install/remove modules. The basic version of Open ERP will include only the required minimum, and you will select the modules thanks to the plug-in manager. This allows you to limit your system to your real needs: quality management, localisations, project and service management, marketing campaigns, and so on... </field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">open</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_3" model="scrum.product.backlog">
<field name="name">Review all terms</field>
<field name="expected_hours">8.0</field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">done</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_4" model="scrum.product.backlog">
<field name="name">Bugfixes</field>
<field name="expected_hours">6.0</field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">open</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_5" model="scrum.product.backlog">
@@ -72,8 +77,9 @@
<record id="scrum_product_backlog_6" model="scrum.product.backlog">
<field name="name">Reshape the complete menu</field>
<field name="expected_hours">4.0</field>
<field name="note">Restrucutre the Open ERP menu to be more like others ERP.</field>
<field name="note">Restructure the Open ERP menu to be more like others ERP.</field>
<field name="sprint_id" ref="scrum_sprint_0"/>
<field name="state">open</field>
<field name="project_id" ref="scrum_project_1"/>
</record>
<record id="scrum_product_backlog_7" model="scrum.product.backlog">
@@ -91,6 +97,8 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Review all English Terms</field>
<field name="state">done</field>
<field eval="time.strftime('%Y-%m-%d')" name="date_close"/>
<field name="product_backlog_id" ref="scrum_product_backlog_3"/>
</record>
<record id="scrum_task_4" model="project.task">
@@ -98,6 +106,8 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Review all french terms</field>
<field name="state">done</field>
<field eval="time.strftime('%Y-%m-%d')" name="date_close"/>
<field name="product_backlog_id" ref="scrum_product_backlog_3"/>
</record>
<record id="scrum_task_5" model="project.task">
@@ -105,6 +115,8 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Analytic Accounting features</field>
<field name="state">done</field>
<field eval="time.strftime('%Y-%m-%d')" name="date_close"/>
<field name="product_backlog_id" ref="scrum_product_backlog_1"/>
</record>
<record id="scrum_task_6" model="project.task">
@@ -112,6 +124,7 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Test and improve automatic migration system</field>
<field name="state">open</field>
<field name="product_backlog_id" ref="scrum_product_backlog_0"/>
</record>
<record id="scrum_task_7" model="project.task">
@@ -119,6 +132,7 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">General accounting features</field>
<field name="state">open</field>
<field name="product_backlog_id" ref="scrum_product_backlog_1"/>
</record>
<record id="scrum_task_8" model="project.task">
@@ -133,7 +147,9 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="description">Cash book, general ledger, accounts list, aged trial balance</field>
<field name="name">Accounting Report General</field>
<field name="name">Accounting Report General</field>
<field name="state">open</field>
<field eval="[(6,0,[ref('scrum.scrum_task_8')])]" name="child_ids"/>
<field name="product_backlog_id" ref="scrum_product_backlog_1"/>
</record>
<record id="scrum_task_10" model="project.task">
@@ -148,6 +164,7 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Accounting Report Analytic</field>
<field name="state">open</field>
<field name="product_backlog_id" ref="scrum_product_backlog_1"/>
</record>
<record id="scrum_task_12" model="project.task">
@@ -155,6 +172,8 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Bugfix - memory leak</field>
<field name="state">done</field>
<field eval="time.strftime('%Y-%m-%d')" name="date_close"/>
<field name="product_backlog_id" ref="scrum_product_backlog_4"/>
</record>
<record id="scrum_task_13" model="project.task">
@@ -162,6 +181,8 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Bugfix - Translations</field>
<field name="state">open</field>
<field eval="[(6,0,[ref('scrum.scrum_task_12')])]" name="child_ids"/>
<field name="product_backlog_id" ref="scrum_product_backlog_4"/>
</record>
<record id="scrum_task_14" model="project.task">
@@ -169,6 +190,7 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Finish the automated plugin system</field>
<field name="state">pending</field>
<field name="product_backlog_id" ref="scrum_product_backlog_2"/>
</record>
<record id="scrum_task_15" model="project.task">
@@ -183,6 +205,7 @@
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
<field name="project_id" ref="scrum_project_1"/>
<field name="name">Test 3.2.0 before releasing</field>
<field name="state">open</field>
<field name="product_backlog_id" ref="scrum_product_backlog_5"/>
</record>
<record id="scrum_task_17" model="project.task">
@@ -191,8 +214,56 @@
<field name="project_id" ref="scrum_project_1"/>
<field name="description">default values, onchange, required, add on top or bottom and shortcuts (Ctrl S, Ctrl X, ...)</field>
<field name="name">Editable trees</field>
<field name="state">open</field>
<field name="product_backlog_id" ref="scrum_product_backlog_7"/>
</record>
<record id="scrum_meeting_0" model="scrum.meeting">
<field name="question_yesterday">
Admin: Worked on the Automatic migration system
Demo: Worked on the Test 3.2.0 before releasing
</field>
<field name="question_today">
Admin:Work on Restructure the Open ERP menu to be more like others ERP.
Demo: Work on Editable trees</field>
<field name="question_blocks">
Demo :Bugfix - memory leak
</field>
<field name="sprint_id" ref="scrum.scrum_sprint_0"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
</record>
<record id="project_task_work_scrum_task1" model="project.task.work">
<field name="user_id" ref="base.user_root"/>
<field name="name">Learn how to migration</field>
<field name="task_id" ref="scrum_task_6"/>
<field name="company_id" ref="base.main_company"/>
<field eval="1.0" name="hours"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
</record>
<record id="project_task_work_scrum_task2" model="project.task.work">
<field name="user_id" ref="base.user_root"/>
<field name="name">Create a script for migration and testing</field>
<field name="task_id" ref="scrum_task_6"/>
<field name="company_id" ref="base.main_company"/>
<field eval="5.0" name="hours"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
</record>
<record id="project_task_work_scrum_task2" model="project.task.work">
<field name="user_id" ref="base.user_root"/>
<field name="name">Create a script for migration and testing</field>
<field name="task_id" ref="scrum_task_6"/>
<field name="company_id" ref="base.main_company"/>
<field eval="5.0" name="hours"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
</record>
<record id="project_task_work_scrum_task1" model="project.task.work">
<field name="user_id" ref="base.user_root"/>
<field name="name">Add on top or bottom and shortcuts</field>
<field name="task_id" ref="scrum_task_17"/>
<field name="company_id" ref="base.main_company"/>
<field eval="10.0" name="hours"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/>
</record>
</data>
</openerp>
+10 -5
View File
@@ -40,7 +40,7 @@
<field name="sprint_id"/>
<field name="user_id"/>
<field name="progress" widget="progressbar"/>
<field name="expected_hours" sum="Expected hours" widget="float_time"/>
<field name="expected_hours" sum="Planned hours" widget="float_time"/>
<field name="effective_hours" sum="Effective hours" widget="float_time"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft,pending" icon="gtk-jump-to"/>
@@ -57,10 +57,13 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product backlog">
<group colspan="4" col="6">
<group colspan="4" col="8">
<field name="name" select="1"/>
<field name="project_id" select="1"/>
<field domain="[('project_id','=',project_id), ('state','in', ['draft','open'])]" name="sprint_id" select="1"/>
<button name="button_postpone" string="Post Pone" type="object"
help="Post Pone backlog" colspan="2"
icon="gtk-convert" attrs="{'invisible':[('state','=','done')]}"/>
<field name="user_id" select="1"/>
<field name="sequence" groups="base.group_extended"/>
<field name="create_date"/>
@@ -71,6 +74,7 @@
<group colspan="6" col="8">
<field name="expected_hours" widget="float_time"/>
<field name="effective_hours" widget="float_time"/>
<field name="task_hours" widget="float_time"/>
</group>
<separator string="Feature Description" colspan="4"/>
<field colspan="4" name="note" nolabel="1"/>
@@ -192,8 +196,7 @@
<field name="date_start"/>
<field name="progress" widget="progressbar"/>
<field name="effective_hours" sum="Effective hours" widget="float_time"/>
<field name="planned_hours" sum="Planned hours" widget="float_time"/>
<field name="expected_hours" sum="Expected hours" widget="float_time"/>
<field name="expected_hours" sum="Planned hours" widget="float_time"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft,pending" icon="gtk-jump-to"/>
<button type="object" string="Pending" name="button_pending" states="open" icon="gtk-media-pause"/>
@@ -226,7 +229,6 @@
</group>
<group colspan="2" col="2">
<separator string="Planning" colspan="2"/>
<field name="planned_hours" widget="float_time"/>
<field name="expected_hours" widget="float_time"/>
<field name="effective_hours" widget="float_time"/>
<field name="progress" widget="progressbar"/>
@@ -329,6 +331,9 @@
<field colspan="4" name="question_today" nolabel="1"/>
<separator colspan="4" string="Are there anything blocking you?"/>
<field colspan="4" name="question_blocks" nolabel="1"/>
<separator colspan="4" string=""/>
<button name="button_send_to_master" type="object" string="Send to Scrum Master" icon="gtk-ok"/>
<button name="button_send_product_owner" type="object" string="Send to Product Owner" icon="gtk-ok"/>
</page>
<page string="Optional Info">
<separator colspan="4" string="Are your Sprint Backlog estimate accurate ?"/>
+1 -1
View File
@@ -49,7 +49,7 @@ class backlog_sprint_assign(osv.osv_memory):
'description': backlog.note,
'project_id': backlog.project_id.id,
'user_id': False,
'planned_hours':backlog.planned_hours,
'planned_hours':backlog.expected_hours,
'remaining_hours':backlog.expected_hours,
})
if data['state_open'] and backlog.state == "draft":