Merge lp:~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto into lp:addons-vauxoo/7.0

Proposed by hbto [Vauxoo] http://www.vauxoo.com
Status: Merged
Approved by: Rafael Silva
Approved revision: 1009
Merged at revision: 1009
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto
Merge into: lp:addons-vauxoo/7.0
Diff against target: 75 lines (+39/-1)
2 files modified
user_story/model/user_story.py (+37/-1)
user_story/view/userstory_view.xml (+2/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Needs Fixing
nhomar Pending
Nhomar - Vauxoo Pending
Rafael (Vauxoo) Pending
Review via email: mp+218128@code.launchpad.net

Description of the change

This MP is intended to add a field to the model
user.story in order to be able to provide end users
with better reports.

To post a comment you must log in.
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

@Hbto,
FYI Esta MP está ciclando uno de los test, tengan en cuenta esto antes de mergear.
http://runbot.vauxoo.com/Chuck_Norris.html#erp_vauxoo_com_-mp-218128

El log es el siguiente
Module project_timesheet: loading test/worktask_entry_to_timesheetline_entry.yml
 Create a user 'HR Manager'
 Create a product with type service used to specify employees designation
 Create an analytic journal for employees timesheet
 Create an employee 'HR Manager' for user 'HR Manager'
 Create a timesheet sheet for HR manager
 Create a project 'Timesheet Management'
 Create a task 'Get all timesheet records'
 Open the task
 Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager.
En esta última línea se queda pegado, y runbot detecta que ya lleva 40 minutos generándose la instancia, y la frena, etiquetándola como "too long".

@Rafa,
Para aprobar una MP, te recomiendo primero probar en runbot en
http://runbot.vauxoo.com/Chuck_Norris.html
Busca el número de la propuesta de merge, y le das "force build", una vez que se genera, puedes conectarte con usuario admin y password admin, para probar funcionalmente la vaina en desarrollo.
Si no está en verde o no te satisface, dispara alarmas, please.
Si todo trabaja fino funcionalmente, ahora sí apruebas.

review: Needs Fixing
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

Moy no se ha mezclado y no se ha puesto a producción por esa precisa razón,

Si estuviera en producción tu preocupación tendría toda la razón, evita el
proceso de minority report
On May 4, 2014 7:32 PM, "Moisés López - http://www.vauxoo.com" <
<email address hidden>> wrote:

> Review: Needs Fixing
>
> @Hbto,
> FYI Esta MP está ciclando uno de los test, tengan en cuenta esto antes de
> mergear.
> http://runbot.vauxoo.com/Chuck_Norris.html#erp_vauxoo_com_-mp-218128
>
> El log es el siguiente
> Module project_timesheet: loading
> test/worktask_entry_to_timesheetline_entry.yml
> Create a user 'HR Manager'
> Create a product with type service used to specify employees designation
> Create an analytic journal for employees timesheet
> Create an employee 'HR Manager' for user 'HR Manager'
> Create a timesheet sheet for HR manager
> Create a project 'Timesheet Management'
> Create a task 'Get all timesheet records'
> Open the task
> Make a work task entry 'Get work calendar of all employees' of 10 hours
> done by HR manager.
> En esta última línea se queda pegado, y runbot detecta que ya lleva 40
> minutos generándose la instancia, y la frena, etiquetándola como "too long".
>
> @Rafa,
> Para aprobar una MP, te recomiendo primero probar en runbot en
> http://runbot.vauxoo.com/Chuck_Norris.html
> Busca el número de la propuesta de merge, y le das "force build", una vez
> que se genera, puedes conectarte con usuario admin y password admin, para
> probar funcionalmente la vaina en desarrollo.
> Si no está en verde o no te satisface, dispara alarmas, please.
> Si todo trabaja fino funcionalmente, ahora sí apruebas.
>
> --
>
> https://code.launchpad.net/~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto/+merge/218128
> You proposed
> lp:~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto for
> merging.
>

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Excelente!
Evita tener una MP con estado como aprobada, cuando aun está en WIP, please.

Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

Copiado
On May 4, 2014 8:12 PM, "Moisés López - http://www.vauxoo.com" <
<email address hidden>> wrote:

> Excelente!
> Evita tener una MP con estado como aprobada, cuando aun está en WIP,
> please.
>
> --
>
> https://code.launchpad.net/~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto/+merge/218128
> You proposed
> lp:~vauxoo/addons-vauxoo/7.0-user_story-effective_hours-dev-hbto for
> merging.
>

1010. By hbto [Vauxoo] http://www.vauxoo.com

[FIX] Stupid Level-8 Mistake

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Que coraje, cuando es un pdb el que te estaba jodiendo la vaina.

Rafa,
Si quieres probarlo en desarrollo, esta es la instancia.
http://runbot.vauxoo.com/Chuck_Norris.html#erp_vauxoo_com_-mp-218128

¡Saludos!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'user_story/model/user_story.py'
2--- user_story/model/user_story.py 2014-04-25 23:32:52 +0000
3+++ user_story/model/user_story.py 2014-05-05 13:19:17 +0000
4@@ -155,6 +155,37 @@
5
6 return False
7
8+ def _hours_get(self, cr, uid, ids, field_names, args, context=None):
9+ res = {}
10+ cr.execute('''
11+ SELECT us.id, COALESCE(SUM(ptw.hours))
12+ FROM project_task_work ptw
13+ INNER JOIN project_task pt ON pt.id = ptw.task_id
14+ INNER JOIN user_story us ON us.id = pt.userstory_id
15+ WHERE us.id IN %s
16+ GROUP BY us.id
17+ ''',(tuple(ids),))
18+ hours = dict(cr.fetchall())
19+ for us_brw in self.browse(cr, uid, ids, context=context):
20+ res[us_brw.id] = hours.get(us_brw.id, 0.0)
21+ return res
22+
23+ def _get_user_story_from_ptw(self, cr, uid, ids, context=None):
24+ result = {}
25+ task_ids = {}
26+ for work in self.pool.get('project.task.work').browse(cr, uid, ids, context=context):
27+ if work.task_id: result[work.task_id.id] = True
28+ task_ids = task_ids.keys()
29+ for task in self.pool.get('project.task').browse(cr, uid, task_ids, context=context):
30+ if task.userstory_id: result[task.userstory_id.id] = True
31+ return result.keys()
32+
33+ def _get_user_story_from_pt(self, cr, uid, ids, context=None):
34+ result = {}
35+ for task in self.pool.get('project.task').browse(cr, uid, ids, context=context):
36+ if task.userstory_id: result[task.userstory_id.id] = True
37+ return result.keys()
38+
39 _columns = {
40 'name': fields.char('Title', size=255, required=True, readonly=False, translate=True),
41 'owner': fields.char('Owner', size=255, readonly=False),
42@@ -193,7 +224,12 @@
43 'categ_ids': fields.many2many('project.category','project_category_user_story_rel','userstory_id','categ_id', string="Tags"),
44 'implementation': fields.text('Implementation Conclusions', translate=True),
45 'help': fields.boolean('Show Help', help='Allows you to show the help in the form'),
46-
47+ 'effective_hours': fields.function(_hours_get, string='Hours Spent', help="Computed using the sum of the task work done.",
48+ store = {
49+ _name: (lambda s, c, u, ids, cx={}: ids, ['task_ids'], 10),
50+ 'project.task': (_get_user_story_from_pt, ['work_ids'], 10),
51+ 'project.task.work': (_get_user_story_from_ptw, ['hours'], 10),
52+ }),
53 }
54 _defaults = {
55 'name': lambda *a: None,
56
57=== modified file 'user_story/view/userstory_view.xml'
58--- user_story/view/userstory_view.xml 2014-04-25 17:45:49 +0000
59+++ user_story/view/userstory_view.xml 2014-05-05 13:19:17 +0000
60@@ -47,6 +47,7 @@
61 </group>
62 <group>
63 <field name="planned_hours" />
64+ <field name="effective_hours" />
65 <field name="sk_id" context="{'current_model3': 'sprint.kanban'}" />
66 <field name="priority_level" widget="selection"/>
67 <field name="categ_ids" widget="many2many_tags" context="{'current_model1': 'project.category'}"/>
68@@ -144,6 +145,7 @@
69 <field name="code" />
70 <field name="priority_level" />
71 <field name="planned_hours" sum="Total hours"/>
72+ <field name="effective_hours" sum="Total hours"/>
73 <field name="project_id" />
74 <field name="user_id" />
75 <field name="sk_id" select="True" />