[FIX] Adding working time in a confirmed timesheet
lp bug: https://launchpad.net/bugs/760493 fixed bzr revid: skh@tinyerp.com-20110415100534-g823ifs3sa7ufz4l
This commit is contained in:
parent
75c16a19cc
commit
c2719f0f8c
|
@ -493,21 +493,10 @@ class hr_timesheet_line(osv.osv):
|
|||
(_check_sheet_state, 'You can not modify an entry in a Confirmed/Done 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'])
|
||||
if not ts.state in ('draft', 'new'):
|
||||
raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !'))
|
||||
return super(hr_timesheet_line,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
self._check(cr, uid, ids)
|
||||
return super(hr_timesheet_line,self).unlink(cr, uid, ids,*args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids, *args, **kwargs):
|
||||
self._check(cr, uid, ids)
|
||||
return super(hr_timesheet_line,self).write(cr, uid, ids,*args, **kwargs)
|
||||
|
||||
def _check(self, cr, uid, ids):
|
||||
for att in self.browse(cr, uid, ids):
|
||||
if att.sheet_id and att.sheet_id.state not in ('draft', 'new'):
|
||||
|
|
Loading…
Reference in New Issue