summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskh <skh@tinyerp.com>2011-04-15 14:19:06 +0530
committerskh <skh@tinyerp.com>2011-04-15 14:19:06 +0530
commit6b83b67f60e6336b8b2e2fdb809e35c1e1b7a3cb (patch)
treec845cd50484250b568474ad6984eaa8a5d86d5ff
parentad0ececa4e84b6abb4e1ba0a7eb96dd31904a9be (diff)
[FIX] Adding working time in a confirmed timesheet
lp bug: https://launchpad.net/bugs/760493 fixed bzr revid: skh@tinyerp.com-20110415084906-j70rij3nfvr77cn3
-rw-r--r--addons/hr_timesheet_sheet/hr_timesheet_sheet.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 23ab63247e5..c65dc810c3e 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -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'])