Merge lp:~vauxoo/addons-vauxoo/7.0-user_story-rev1-kty into lp:addons-vauxoo/7.0

Proposed by Katherine Zaoral (Vauxoo)
Status: Merged
Merged at revision: 969
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-user_story-rev1-kty
Merge into: lp:addons-vauxoo/7.0
Diff against target: 451 lines (+293/-21)
5 files modified
user_story/__openerp__.py (+1/-0)
user_story/data/data.xml (+11/-0)
user_story/demo/demo.xml (+65/-0)
user_story/model/user_story.py (+116/-16)
user_story/view/userstory_view.xml (+100/-5)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-user_story-rev1-kty
Reviewer Review Type Date Requested Status
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com Approve
Katherine Zaoral (Vauxoo) Approve
Review via email: mp+208309@code.launchpad.net

Commit message

[MERGE] improve the user story view and model

Description of the change

[MERGE] improve the user story view and model

To post a comment you must log in.
Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

There is a problem in the related fields defined at the acceptability.criteria model.
When the realated field is updated through the user.story the related field do not update.
I need to change the store=True to a sensitive store that listen to user.story model changes.
I also presume that I need to change the realated fields to functional fields.
After this changes are corrected I will report for this media that the merge is approve for my side.
regards.

review: Needs Fixing
986. By Katherine Zaoral (Vauxoo)

[FIX] add readonly True on the related fields for the user story search pad.

987. By Katherine Zaoral (Vauxoo)

[FIX] There was a problem when trying to display the acceptability.criteria
recrods in the corresponding tree view. The group by project do not group
correctly for first instance of the acceptability critearia. I modificate the
project_id field to be a function type of a m2o relationship. Also the field is
now store sensitive to the user.story model and to it self.

988. By Katherine Zaoral (Vauxoo)

[IMP] modifcate the get_project_id method to _get_user_story_field method. This
method is use as the function attribute in the functional fields how wants to
extract data from the user.story model. By this the acceptability.critearia
fields that are pull from the user.story model need to have the same field
name.

989. By Katherine Zaoral (Vauxoo)

[ADD] apply the same changes of the project_id field over the sk_id field.

990. By Katherine Zaoral (Vauxoo)

[ADD] change the tag related field to a functional sentitive storable field.
the field name is change to categ_ids.

991. By Katherine Zaoral (Vauxoo)

[ADD] change the user_id related field to a functional sentitive storable
field.

992. By Katherine Zaoral (Vauxoo)

[ADD] change the user_execute_id related field to a functional sentitive
storable field.

993. By Katherine Zaoral (Vauxoo)

[ADD] add simple data demo.

Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

Jose please check the mp with the new changes.
Please check if it fulfill the goals.
Waiting for your approve
Regards

review: Approve
Revision history for this message
Jose Antonio Morales Ponce(vauxoo) - - http://www.vauxoo.com (josemoralesp) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'user_story/__openerp__.py'
2--- user_story/__openerp__.py 2013-04-04 19:05:37 +0000
3+++ user_story/__openerp__.py 2014-02-28 03:30:29 +0000
4@@ -52,6 +52,7 @@
5 "init_xml" : [
6 ],
7 "demo_xml" : [
8+ 'demo/demo.xml',
9 ],
10 "update_xml" : [
11 "report/ir_report.xml",
12
13=== modified file 'user_story/data/data.xml'
14--- user_story/data/data.xml 2013-04-24 23:51:50 +0000
15+++ user_story/data/data.xml 2014-02-28 03:30:29 +0000
16@@ -2,6 +2,17 @@
17 <openerp>
18 <data>
19
20+ <!-- User Story Priority -->
21+ <record id="usp_urgent" model="user.story.priority">
22+ <field name="name">Urgent</field>
23+ </record>
24+ <record id="usp_priority" model="user.story.priority">
25+ <field name="name">Priority</field>
26+ </record>
27+ <record id="usp_secondary" model="user.story.priority">
28+ <field name="name">Secondary</field>
29+ </record>
30+
31 <!-- Task-related subtypes for messaging / Chatter -->
32 <record id="mt_task_new" model="mail.message.subtype">
33 <field name="name">Task Created</field>
34
35=== added directory 'user_story/demo'
36=== added file 'user_story/demo/demo.xml'
37--- user_story/demo/demo.xml 1970-01-01 00:00:00 +0000
38+++ user_story/demo/demo.xml 2014-02-28 03:30:29 +0000
39@@ -0,0 +1,65 @@
40+<?xml version='1.0' encoding='UTF-8'?>
41+<openerp>
42+ <data noupdate="1">
43+
44+ <record id="us_1" model="user.story">
45+ <field name="name">us 1</field>
46+ <field name="owner">ow 1</field>
47+ <field name="project_id" ref="project.project_project_1"/>
48+ </record>
49+
50+ <record id="us_2" model="user.story">
51+ <field name="name">us 2</field>
52+ <field name="owner">ow 2</field>
53+ <field name="project_id" ref="project.project_project_1"/>
54+ </record>
55+
56+ <record id="us_3" model="user.story">
57+ <field name="name">us 3</field>
58+ <field name="owner">ow 3</field>
59+ <field name="project_id" ref="project.project_project_2"/>
60+ </record>
61+
62+ <record id="ac_11" model="acceptability.criteria">
63+ <field name="name">criterion 1.1</field>
64+ <field name="scenario">sc 1.1</field>
65+ <field name="accep_crit_id" ref="us_1"/>
66+ <field name="development">True</field>
67+ <field name="difficulty">low</field>
68+ </record>
69+
70+ <record id="ac_12" model="acceptability.criteria">
71+ <field name="name">criterion 1.2</field>
72+ <field name="scenario">sc 1.2</field>
73+ <field name="accep_crit_id" ref="us_1"/>
74+ <field name="accepted">True</field>
75+ <field name="difficulty">high</field>
76+ </record>
77+
78+ <record id="ac_21" model="acceptability.criteria">
79+ <field name="name">criterion 2.1</field>
80+ <field name="scenario">sc 2.1</field>
81+ <field name="accep_crit_id" ref="us_2"/>
82+ <field name="development">True</field>
83+ </record>
84+
85+ <record id="ac_22" model="acceptability.criteria">
86+ <field name="name">criterion 2.2</field>
87+ <field name="scenario">sc 2.2</field>
88+ <field name="accep_crit_id" ref="us_2"/>
89+ <field name="difficulty">low</field>
90+ </record>
91+
92+ <record id="ac_31" model="acceptability.criteria">
93+ <field name="name">criterion 3.1</field>
94+ <field name="scenario">sc 3.1</field>
95+ <field name="accep_crit_id" ref="us_3"/>
96+ <field name="difficulty">low</field>
97+ </record>
98+
99+ <record id="group_user_story_manager" model="res.groups">
100+ <field name="users" eval="[(4,ref('base.user_root'))]"/>
101+ </record>
102+
103+ </data>
104+</openerp>
105
106=== modified file 'user_story/model/user_story.py'
107--- user_story/model/user_story.py 2013-10-23 19:58:11 +0000
108+++ user_story/model/user_story.py 2014-02-28 03:30:29 +0000
109@@ -86,27 +86,25 @@
110
111
112 _columns = {
113- 'name': fields.char('Title', size=255, required=True, readonly=False),
114+ 'name': fields.char('Title', size=255, required=True, readonly=False,
115+ translate=True),
116 'owner': fields.char('Owner', size=255, required=True, readonly=False),
117 'code': fields.char('Code', size=64, readonly=False),
118 'planned_hours': fields.float('Planned Hours'),
119 'project_id': fields.many2one('project.project', 'Project',
120 required=True),
121- 'description': fields.text('Description'),
122+ 'description': fields.text('Description', translate=True),
123 'accep_crit_ids': fields.one2many('acceptability.criteria',
124 'accep_crit_id',
125 'Acceptability Criteria',
126 required=False),
127- 'info': fields.text('Other Info'),
128- 'priority_level':fields.selection([('urgent','Urgent'),
129- ('priority','Priority'),
130- ('secondary','Secondary')],
131- 'Priority Level',
132- help='User story level priority,'
133- ' used to define priority'
134- ' for each user story'),
135-
136- 'asumption': fields.text('Asumptions'),
137+ 'info': fields.text('Other Info', translate=True),
138+ 'priority_level':fields.many2one(
139+ 'user.story.priority',
140+ 'Priority Level',
141+ help=('User story level priority, used to define priority for'
142+ ' each user story')),
143+ 'asumption': fields.text('Asumptions', translate=True),
144 'date': fields.date('Date'),
145 'user_id': fields.many2one('res.users', 'Responsible Supervisor',help="Person responsible for interacting with the client to give details of the progress or completion of the User History, in some cases also the supervisor for the correct execution of the user story."),
146 'user_execute_id': fields.many2one('res.users', 'Responsible Execution',help="Person responsible for user story takes place, either by delegating work to other human capital or running it by itself. For delegate work should monitor the proper implementation of associated activities."),
147@@ -115,11 +113,12 @@
148 'task_ids': fields.function(_get_tasks, type='many2many',
149 relation="project.task",
150 fnct_inv=_set_task,
151- string="Tasksss",
152+ string="Tasks",
153 help="""Draft procurement of
154 the product and location
155 of that orderpoint"""),
156 'categ_ids': fields.many2many('project.category','project_category_user_story_rel','userstory_id','categ_id', string="Tags"),
157+ 'implementation': fields.text('Implementation Conclusions', translate=True),
158 }
159 _defaults = {
160 'name': lambda *a: None,
161@@ -127,7 +126,9 @@
162 'user_id': lambda self, cr, uid, ctx: uid,
163 'user_execute_id': lambda self, cr, uid, ctx: uid,
164 'state': 'draft',
165- 'priority_level':'secondary',
166+ 'priority_level': lambda self, cr, uid, ctx: self.pool.get(
167+ 'user.story.priority').search(
168+ cr, uid, [('name', 'like', 'Secondary')], context=ctx)[0]
169 }
170
171 def do_draft(self, cr, uid, ids, context=None):
172@@ -146,6 +147,16 @@
173 return self.write(cr, uid, ids, {'state': 'cancelled'},
174 context=context)
175
176+class user_story_priority(osv.Model):
177+ """
178+ User Story Priority Level
179+ """
180+
181+ _name = 'user.story.priority'
182+ _columns = {
183+ 'name': fields.char('Name', size=255, required=True),
184+ }
185+
186
187 class acceptability_criteria(osv.Model):
188 """
189@@ -154,17 +165,106 @@
190
191 _name = 'acceptability.criteria'
192
193+ def _get_ac_ids_by_us_ids(self, cr, uid, us_ids, context=None):
194+ """
195+ This method is as the method of the sensitive store tuple for the
196+ functional fields defined in the current field that pretend to pull
197+ data form the user.story model. The method get us_ids and make a search
198+ for the acceptability.criteria records that need to be updated.
199+ @return a list of the acceptability.criteria that need to be updated.
200+ """
201+ context = context or {}
202+ us_obj = self.pool.get('user.story')
203+ ac_obj = self.pool.get('acceptability.criteria')
204+ ac_ids = ac_obj.search(
205+ cr, uid, [('accep_crit_id', 'in', us_ids)], context=context)
206+ return ac_ids
207+
208+ def _get_user_story_field(self, cr, uid, ids, fieldname, arg, context=None):
209+ """
210+ Method used as the function for extracting values for the user.story
211+ model using functional fields. This method is used for various fields,
212+ the fieldname it matters to extract the value, the field name need to
213+ be the same from the user.story model.
214+ """
215+ context = context or {}
216+ res = {}.fromkeys(ids)
217+ for ac_brw in self.browse(cr, uid, ids, context=context):
218+ res[ac_brw.id] = \
219+ getattr(ac_brw.accep_crit_id, fieldname, False) and \
220+ getattr(ac_brw.accep_crit_id, fieldname).id or False
221+ return res
222+
223 _columns = {
224- 'name': fields.char('Title', size=255, required=True, readonly=False),
225- 'scenario': fields.text('Scenario', required=True),
226+ 'name': fields.char('Title', size=255, required=True, readonly=False,
227+ translate=True),
228+ 'scenario': fields.text('Scenario', required=True, translate=True),
229 'accep_crit_id': fields.many2one('user.story',
230 'User Story',
231 required=True),
232 'accepted': fields.boolean('Accepted',
233 help='Chek if this criteria apply'),
234+ 'development': fields.boolean('Development'),
235+ 'difficulty': fields.selection(
236+ [('low','Low'),
237+ ('medium','Medium'),
238+ ('high','High'),
239+ ('na','Not Apply')],
240+ string='Difficulty'),
241+ 'project_id': fields.function(
242+ _get_user_story_field,
243+ type="many2one",
244+ relation='project.project',
245+ string='Project',
246+ help='User Story Project',
247+ store={
248+ 'acceptability.criteria': (lambda s, c, u, i, ctx: i, ['accep_crit_id'], 16),
249+ 'user.story': (_get_ac_ids_by_us_ids, ['project_id'], 20),
250+ }),
251+ 'sk_id': fields.function(
252+ _get_user_story_field,
253+ type="many2one",
254+ relation="sprint.kanban",
255+ string='Sprint',
256+ help='Sprint Kanban',
257+ store={
258+ 'acceptability.criteria': (lambda s, c, u, i, ctx: i, ['accep_crit_id'], 16),
259+ 'user.story': (_get_ac_ids_by_us_ids, ['sk_id'], 20),
260+ }),
261+ 'categ_ids': fields.function(
262+ _get_user_story_field,
263+ type="many2one",
264+ relation="project.category",
265+ string='Tag',
266+ help='Tag',
267+ store={
268+ 'acceptability.criteria': (lambda s, c, u, i, ctx: i, ['accep_crit_id'], 16),
269+ 'user.story': (_get_ac_ids_by_us_ids, ['categ_ids'], 20),
270+ }),
271+ 'user_id': fields.function(
272+ _get_user_story_field,
273+ type="many2one",
274+ relation="res.users",
275+ string='Responsible Supervisor',
276+ help='Responsible Supervisor',
277+ store={
278+ 'acceptability.criteria': (lambda s, c, u, i, ctx: i, ['accep_crit_id'], 16),
279+ 'user.story': (_get_ac_ids_by_us_ids, ['user_id'], 20),
280+ }),
281+ 'user_execute_id': fields.function(
282+ _get_user_story_field,
283+ type="many2one",
284+ relation="res.users",
285+ string='Responsible Execution',
286+ help='Responsible Execution',
287+ store={
288+ 'acceptability.criteria': (lambda s, c, u, i, ctx: i, ['accep_crit_id'], 16),
289+ 'user.story': (_get_ac_ids_by_us_ids, ['user_execute_id'], 20),
290+ }),
291 }
292 _defaults = {
293 'name': lambda *a: None,
294+ 'difficulty': 'na',
295 }
296
297
298
299=== modified file 'user_story/view/userstory_view.xml'
300--- user_story/view/userstory_view.xml 2013-10-23 21:00:08 +0000
301+++ user_story/view/userstory_view.xml 2014-02-28 03:30:29 +0000
302@@ -46,7 +46,7 @@
303 <group>
304 <field name="planned_hours" />
305 <field name="sk_id" context="{'current_model3': 'sprint.kanban'}" />
306- <field name="priority_level" />
307+ <field name="priority_level" widget="selection"/>
308 <field name="categ_ids" widget="many2many_tags" context="{'current_model1': 'project.category'}"/>
309 </group>
310 </group>
311@@ -95,10 +95,12 @@
312 </page>
313
314 <page string="GAP analysis results">
315- <label for="info" colspan="4" string="5.- Conclusion of analysis" class="oe_horizontal_separator oe_clear"/>
316+ <label for="info" colspan="4" string="5.- Technical Conclusions" class="oe_horizontal_separator oe_clear"/>
317 <field name="info" colspan="4" placeholder="Add a other info here ..."/>
318 <label for="asumption" colspan="4" string="6.- Asumptions" class="oe_horizontal_separator oe_clear"/>
319 <field name="asumption" colspan="4" placeholder="Add a asumptions here ..."/>
320+ <label for="implementation" colspan="4" string="7.- Implementation Conclusions" class="oe_horizontal_separator oe_clear"/>
321+ <field name="implementation" colspan="4" placeholder="Add a Implementation Conclusions here ..."/>
322 </page>
323
324 <page string="Tasks">
325@@ -136,6 +138,79 @@
326 </field>
327 </record>
328
329+ <record model="ir.ui.view" id="view_acceptability_criteria_form">
330+ <field name="name">acceptability.criteria.form</field>
331+ <field name="model">acceptability.criteria</field>
332+ <field name="arch" type="xml">
333+ <form string="Acceptability Criterion" version="7.0">
334+ <sheet string="Acceptability Criterion">
335+ <h1><label for="id" string="Acceptability Criterion" class="oe_horizontal_separator oe_clear"/>
336+ <field name="id" readonly="True"/>
337+ <field name="name" placeholder="Acceptabilit Criterion summary..."/>
338+ </h1>
339+ <group>
340+ <field name="scenario"/>
341+ <field name="accep_crit_id"/>
342+ <field name="accepted"/>
343+ <field name="development"/>
344+ <field name="difficulty"/>
345+ </group>
346+ </sheet>
347+ </form>
348+ </field>
349+ </record>
350+
351+ <record model="ir.ui.view" id="view_acceptability_criteria_tree">
352+ <field name="name">acceptability.criteria.tree</field>
353+ <field name="model">acceptability.criteria</field>
354+ <field name="arch" type="xml">
355+ <tree string="Acceptability Criteria">
356+ <field name="id"/>
357+ <field name="name"/>
358+ <field name="scenario"/>
359+ <field name="accep_crit_id"/>
360+ <field name="project_id" invisible="True"/>
361+ <field name="sk_id" invisible="True"/>
362+ <field name="categ_ids" invisible="True"/>
363+ <field name="user_id" invisible="True"/>
364+ <field name="user_execute_id" invisible="True"/>
365+ <field name="accepted"/>
366+ <field name="development"/>
367+ <field name="difficulty"/>
368+ </tree>
369+ </field>
370+ </record>
371+
372+ <record id="view_acceptability_criteria_search" model="ir.ui.view">
373+ <field name="name">acceptability.criteria.search</field>
374+ <field name="model">acceptability.criteria</field>
375+ <field name="arch" type="xml">
376+ <search string="Acceptability Criteria">
377+ <group string="Filter">
378+ <field name="id"/>
379+ <field name="name"/>
380+ <field name="scenario"/>
381+ <field name="accep_crit_id"/>
382+ <field name="accepted"/>
383+ <field name="development"/>
384+ <field name="difficulty"/>
385+ </group>
386+ <filter name="accept_criteria_development" string="In Development" domain="[('development','=',True)]"/>
387+ <filter name="accept_criteria_accepted" string="Accepted" domain="[('accepted','=',True)]"/>
388+ <group expand="1" string="Group By...">
389+ <filter name="accept_criteria_user_story_id" string="User Story" context="{'group_by':'accep_crit_id'}"/>
390+ <filter name="accept_criteria_difficulty" string="Difficulty" context="{'group_by':'difficulty'}"/>
391+ <separator/>
392+ <filter name="accept_criteria_project_id" string="Project" context="{'group_by':'project_id'}"/>
393+ <filter name="accept_criteria_sk_id" string="Sprint" context="{'group_by':'sk_id'}"/>
394+ <filter name="accept_criteria_categ_ids" string="Tag" context="{'group_by':'categ_ids'}"/>
395+ <filter name="accept_criteria_user_id" string="Responsible Supervisor" context="{'group_by':'user_id'}"/>
396+ <filter name="accept_criteria_user_execute_id" string="Responsible Execution" context="{'group_by':'user_execute_id'}"/>
397+ </group>
398+ </search>
399+ </field>
400+ </record>
401+
402 <record id="view_userstory_search" model="ir.ui.view">
403 <field name="name">user.story.search</field>
404 <field name="model">user.story</field>
405@@ -173,6 +248,7 @@
406 </field>
407 </record>
408
409+
410 <record model="ir.actions.act_window" id="action_my_user_story">
411 <field name="name">My User Stories Exc</field>
412 <field name="res_model">user.story</field>
413@@ -182,8 +258,23 @@
414 <field name="view_id" ref="view_userstory_tree"/>
415 </record>
416
417+ <record model="ir.actions.act_window" id="action_acceptability_criteria">
418+ <field name="name">Acceptability Criteria</field>
419+ <field name="res_model">acceptability.criteria</field>
420+ <field name="view_type">form</field>
421+ <field name="view_mode">tree,form</field>
422+ <field name="view_id" ref="view_acceptability_criteria_tree"/>
423+ </record>
424+
425+ <record model="ir.actions.act_window" id="action_user_story_priority">
426+ <field name="name">Priority Level</field>
427+ <field name="res_model">user.story.priority</field>
428+ <field name="view_type">form</field>
429+ <field name="view_mode">tree,form</field>
430+ </record>
431+
432 <record model="ir.actions.act_window" id="action_user_story">
433- <field name="name">User Story</field>
434+ <field name="name">User Stories</field>
435 <field name="res_model">user.story</field>
436 <field name="view_type">form</field>
437 <field name="view_mode">tree,form</field>
438@@ -200,8 +291,12 @@
439 </p>
440 </field>
441 </record>
442- <menuitem parent="project.menu_project_management" id="menu_action_user_story" action="action_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
443- <menuitem parent="project.menu_project_management" id="menu_action_my_user_story" action="action_my_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
444+ <menuitem parent="base.menu_main_pm" sequence="2" id="menu_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user" name="User Story"/>
445+ <menuitem parent="menu_user_story" id="menu_action_user_story" action="action_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
446+ <menuitem parent="menu_user_story" id="menu_action_my_user_story" action="action_my_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
447+ <menuitem parent="menu_user_story" id="menu_acceptability_criteria" action="action_acceptability_criteria" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
448+ <menuitem parent="base.menu_definitions" id="menu_conf_user_story" groups="user_story.group_user_story_manager,user_story.group_user_story_user" name="User Story"/>
449+ <menuitem parent="menu_conf_user_story" id="menu_config_user_story_priority" action="action_user_story_priority" groups="user_story.group_user_story_manager,user_story.group_user_story_user"/>
450 </data>
451 </openerp>
452