Merge lp:~openerp-dev/openobject-addons/6.1-bug-972544-vba into lp:openobject-addons/6.1

Proposed by Vijaykumar Baladaniya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-bug-972544-vba
Merge into: lp:openobject-addons/6.1
Diff against target: 21 lines (+8/-3)
1 file modified
project/project.py (+8/-3)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-bug-972544-vba
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+124148@code.launchpad.net

Description of the change

Hello Sir,

    I have improve the code for move a task to a stage that is defined on the project of the task. Kindly review the code.

Thanks,
Vijay Baladaniya

To post a comment you must log in.

Unmerged revisions

6977. By Vijaykumar Baladaniya (OpenERP)

[FIX] Not possible to move a task to a stage that is not defined on the project.

6976. By Vijaykumar Baladaniya (OpenERP)

[FIX] Possible to move a task to a stage that is defined on the project of the task.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project/project.py'
2--- project/project.py 2012-07-20 15:12:03 +0000
3+++ project/project.py 2012-09-13 10:05:23 +0000
4@@ -1043,9 +1043,14 @@
5 new_stage = vals.get('type_id')
6 vals_reset_kstate = dict(vals, kanban_state='normal')
7 for t in self.browse(cr, uid, ids, context=context):
8- write_vals = vals_reset_kstate if t.type_id != new_stage else vals
9- super(task,self).write(cr, uid, [t.id], write_vals, context=context)
10- result = True
11+ if t.project_id.type_ids:
12+ stage_id = [ item.id for item in t.project_id.type_ids]
13+ if new_stage in (stage_id):
14+ write_vals = vals_reset_kstate if t.type_id != new_stage else vals
15+ super(task,self).write(cr, uid, [t.id], write_vals, context=context)
16+ result = True
17+ else:
18+ result = False
19 else:
20 result = super(task,self).write(cr, uid, ids, vals, context=context)
21 if ('type_id' in vals) or ('remaining_hours' in vals) or ('user_id' in vals) or ('state' in vals) or ('kanban_state' in vals):