Skip to content

Commit 5a10b27

Browse files
committed
version 1.3
1 parent 6aff3fe commit 5a10b27

File tree

4 files changed

+148
-133
lines changed

4 files changed

+148
-133
lines changed

project_scrum/__openerp__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{
1010
'name': 'Project Scrum',
11-
'version': '1.2',
11+
'version': '1.3',
1212
'category': 'Project Management',
1313
'description': """
1414
Using Scrum to plan the work in a team.

project_scrum/project_scrum.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ def test_task(self, cr, uid, sprint, pool):
3939
'categ_ids': [(6,_,tags)],
4040
})
4141

42-
def _task_count(self): # method that calculate how many tasks exist
43-
for p in self:
44-
p.task_count = len(p.task_ids)
45-
46-
def _test_count(self): # method that calculate how many test cases exist
47-
for p in self:
48-
p.test_count = len(p.test_ids)
42+
#def _task_count(self): # method that calculate how many tasks exist
43+
#for p in self:
44+
#p.task_count = len(p.task_ids)
45+
46+
#def _task_test_count(self): # method that calculate how many tasks in testing exist
47+
#task = self.env['project.task'].search([('categ_ids','ilike','test')])
48+
#for p in self:
49+
#p.task_test_count = len(p.task_test_ids)
4950

5051
name = fields.Char(string = 'Sprint Name', required=True)
5152
meeting_ids = fields.One2many(comodel_name = 'project.scrum.meeting', inverse_name = 'sprint_id', string ='Daily Scrum')
@@ -60,9 +61,9 @@ def _test_count(self): # method that calculate how many test cases exist
6061
scrum_master_id = fields.Many2one(comodel_name = 'res.users', string = 'Scrum Master', required=False,help="The person who is maintains the processes for the product")
6162
us_ids = fields.One2many(comodel_name = 'project.scrum.us', inverse_name = 'sprint_id', string = 'User Stories')
6263
task_ids = fields.One2many(comodel_name = 'project.task', inverse_name = 'us_id')
63-
task_count = fields.Integer(compute = '_task_count')
64-
test_ids = fields.One2many(comodel_name = 'project.scrum.test', inverse_name = 'user_story_id_test')
65-
test_count = fields.Integer(compute = '_test_count')
64+
#task_count = fields.Integer(compute = '_task_count')
65+
task_test_ids = fields.One2many(comodel_name = 'project.scrum.test', inverse_name = 'user_story_id_test')
66+
#task_test_count = fields.Integer(compute = '_task_test_count')
6667
review = fields.Html(string = 'Sprint Review', default="""
6768
<h1 style="color:blue"><ul>What was the goal of this sprint?</ul></h1><br/><br/>
6869
<h1 style="color:blue"><ul>Does the goal have been reached?</ul></h1><br/><br/>
@@ -105,9 +106,27 @@ def _test_count(self): # method that calculate how many test cases exist
105106
for p in self:
106107
p.test_count = len(p.test_ids)
107108

109+
def _resolve_project_id_from_context(self, cr, uid, context=None):
110+
""" Returns ID of project based on the value of 'default_project_id'
111+
context key, or None if it cannot be resolved to a single
112+
project.
113+
"""
114+
if context is None:
115+
context = {}
116+
if type(context.get('default_project_id')) in (int, long):
117+
return context['default_project_id']
118+
if isinstance(context.get('default_project_id'), basestring):
119+
project_name = context['default_project_id']
120+
project_ids = self.pool.get('project.project').name_search(cr, uid, name=project_name, context=context)
121+
if len(project_ids) == 1:
122+
return project_ids[0][0]
123+
return None
124+
108125
@api.model
109126
def _read_group_sprint_id(self, present_ids, domain, **kwargs):
110-
sprints = self.env['project.scrum.sprint'].search([]).name_get()
127+
project_id = self._resolve_project_id_from_context()
128+
sprints = self.env['project.scrum.sprint'].search([('project_id', '=', project_id)], order='sequence').name_get()
129+
#sprints.sorted(key=lambda r: r.sequence)
111130
return sprints, None
112131

113132
_group_by_full = {
@@ -244,10 +263,6 @@ class test_case(models.Model):
244263
stats_test = fields.Selection([('draft','Draft'),('in progress','In Progress'),('cancel','Cancelled')], string='State', required=False)
245264

246265
def _resolve_project_id_from_context(self, cr, uid, context=None):
247-
""" Returns ID of project based on the value of 'default_project_id'
248-
context key, or None if it cannot be resolved to a single
249-
project.
250-
"""
251266
if context is None:
252267
context = {}
253268
if type(context.get('default_project_id')) in (int, long):

0 commit comments

Comments
 (0)