Merge lp:~camptocamp/hr-timesheet/7.0-fix-1189459 into lp:~hr-core-editors/hr-timesheet/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 46
Proposed branch: lp:~camptocamp/hr-timesheet/7.0-fix-1189459
Merge into: lp:~hr-core-editors/hr-timesheet/7.0
Diff against target: 12 lines (+1/-1)
1 file modified
timesheet_task/project_task.py (+1/-1)
To merge this branch: bzr merge lp:~camptocamp/hr-timesheet/7.0-fix-1189459
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no tset Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+168435@code.launchpad.net

Description of the change

[FIX] timesheet_task - ProjectTask write can receive a dict with {project_id: False} when duplicating

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

I think you can use the shortcut "vals.get('project_id')" in this case.

review: Needs Fixing
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Good point, this is fixed

Thanks

44. By Yannick Vaucher @ Camptocamp

[IMP] timesheet_task - use get() to simplify check on dict value in write of ProjectTask

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks!

review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (code review, no tset)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'timesheet_task/project_task.py'
2--- timesheet_task/project_task.py 2013-05-13 07:33:44 +0000
3+++ timesheet_task/project_task.py 2013-06-11 08:10:44 +0000
4@@ -83,7 +83,7 @@
5
6 def write(self, cr, uid, ids, vals, context=None):
7 res = super(ProjectTask, self).write(cr, uid, ids, vals, context=context)
8- if 'project_id' in vals:
9+ if vals.get('project_id'):
10 ts_obj = self.pool.get('hr.analytic.timesheet')
11 project_obj = self.pool.get('project.project')
12 project = project_obj.browse(cr, uid, vals['project_id'], context)

Subscribers

People subscribed via source and target branches