Merge lp:~camptocamp/ocb-addons/7.0-fix-1190934 into lp:ocb-addons

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 9453
Proposed branch: lp:~camptocamp/ocb-addons/7.0-fix-1190934
Merge into: lp:ocb-addons
Diff against target: 27 lines (+14/-3)
1 file modified
hr_timesheet_sheet/hr_timesheet_sheet.py (+14/-3)
To merge this branch: bzr merge lp:~camptocamp/ocb-addons/7.0-fix-1190934
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Guewen Baconnier @ Camptocamp Approve
Review via email: mp+177414@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
--- hr_timesheet_sheet/hr_timesheet_sheet.py 2013-06-24 10:31:45 +0000
+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2013-07-29 15:19:35 +0000
@@ -339,9 +339,20 @@
339 def _check_sheet_state(self, cr, uid, ids, context=None):339 def _check_sheet_state(self, cr, uid, ids, context=None):
340 if context is None:340 if context is None:
341 context = {}341 context = {}
342 for timesheet_line in self.browse(cr, uid, ids, context=context):342 ts_sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
343 if timesheet_line.sheet_id and timesheet_line.sheet_id.state not in ('draft', 'new'):343 # When a timesheet_line is created from view tree of
344 return False344 # hr.analytic.timesheet sheet_id is not defined at this stage
345 # here we check the state of the timesheet for the given date
346 # Furthermore we don't want a default sheet_id allowing to bypass
347 # the check so we recompute all sheet_ids
348 sheet_ids = self._sheet(cr ,uid, ids, False, False, context=context)
349 for ts_line_id, sheet in sheet_ids.iteritems():
350
351 if sheet:
352 ts_sheet = ts_sheet_obj.browse(cr, uid, sheet[0], context=context)
353 if ts_sheet.state not in ('draft', 'new'):
354 return False
355
345 return True356 return True
346357
347 _constraints = [358 _constraints = [