1
##############################################################################
3
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
5
# $Id: sign_in_out.py 2871 2006-04-25 14:08:22Z ged $
7
# WARNING: This program as such is intended to be used by professional
8
# programmers who take the whole responsability of assessing all potential
9
# consequences resulting from its eventual inadequacies and bugs
10
# End users who are looking for a ready-to-use solution with commercial
11
# garantees and support are strongly adviced to contract a Free Software
14
# This program is Free Software; you can redistribute it and/or
15
# modify it under the terms of the GNU General Public License
16
# as published by the Free Software Foundation; either version 2
17
# of the License, or (at your option) any later version.
19
# This program is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU General Public License for more details.
24
# You should have received a copy of the GNU General Public License
25
# along with this program; if not, write to the Free Software
26
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
##############################################################################
36
class wiz_timesheet_open(wizard.interface):
37
def _open_timesheet(self, cr, uid, data, context):
38
ts = pooler.get_pool(cr.dbname).get('hr_timesheet_sheet.sheet')
39
ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
40
view_type = 'form,tree'
42
view_type = 'tree,form'
43
domain = "[('id','in',["+','.join(map(str,ids))+"])]"
45
ts.write(cr, uid, ids, {'date_current': time.strftime('%y-%m-%d')})
51
'name': 'Open timesheet',
53
'view_mode': view_type,
54
'res_model': 'hr_timesheet_sheet.sheet',
56
'type': 'ir.actions.act_window'
59
value['res_id'] = ids[0]
67
'result' : {'type':'action', 'action':_open_timesheet, 'state':'end'}
70
wiz_timesheet_open('hr_timesheet_sheet.current.open')
72
# vim:noexpandtab:tw=0