[FIX] Adding working time in a confirmed timesheet
lp bug: https://launchpad.net/bugs/760493 fixed bzr revid: skh@tinyerp.com-20110415084906-j70rij3nfvr77cn3
This commit is contained in:
parent
ad0ececa4e
commit
6b83b67f60
|
@ -481,6 +481,19 @@ class hr_timesheet_line(osv.osv):
|
|||
'date': _get_default_date,
|
||||
}
|
||||
|
||||
def _check_sheet_state(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
line = self.browse(cr, uid, ids, context=context)
|
||||
for timesheet in line:
|
||||
if timesheet.sheet_id and timesheet.sheet_id.state not in ('draft', 'new'):
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_sheet_state, 'You can not modify an entry in a confirmed timesheet !.', ['state']),
|
||||
]
|
||||
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if vals.get('sheet_id', False):
|
||||
ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, vals['sheet_id'])
|
||||
|
|
Loading…
Reference in New Issue