HR_TIMESHEET_SHEET
authorFabien Pinckaers <fp@tinyerp.com>
Wed, 11 Apr 2007 05:51:27 +0000 (05:51 +0000)
committerFabien Pinckaers <fp@tinyerp.com>
Wed, 11 Apr 2007 05:51:27 +0000 (05:51 +0000)
bzr revid: fp@tinyerp.com-c933b8c634b44a56c328d5b88401984bd8202743

addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
addons/hr_timesheet_sheet/wizard/wizard_timesheet_current.py

index 3eb652d..fdee6e1 100644 (file)
@@ -56,7 +56,7 @@
                                                </group>
                                                <button string="Sign In" name="sign_in" type="object"/>
                                                <button string="Sign Out" name="sign_out" type="object"/>
-                                               <field name="attendances_ids" colspan="4" nolabel="1" context="name=date_current">
+                                               <field name="attendances_ids" colspan="4" nolabel="1" context="name=date_current" height="100">
                                                        <tree string="Attendances">
                                                                <field name="employee_id"/>
                                                                <field name="name"/>
index ee11c36..39321ab 100644 (file)
@@ -32,10 +32,15 @@ import wizard
 import netsvc
 import time
 import pooler
+from osv import osv
 
 class wiz_timesheet_open(wizard.interface):
        def _open_timesheet(self, cr, uid, data, context):
-               ts = pooler.get_pool(cr.dbname).get('hr_timesheet_sheet.sheet')
+               pool = pooler.get_pool(cr.dbname)
+               user_ids = pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
+               if not len(user_ids):
+                       raise wizard.except_wizard('Error !', 'No employee defined for your user !')
+               ts = pool.get('hr_timesheet_sheet.sheet')
                ids = ts.search(cr, uid, [('user_id','=',uid),('state','=','draft'),('date_from','<=',time.strftime('%Y-%m-%d')), ('date_to','>=',time.strftime('%Y-%m-%d'))])
                view_type = 'form,tree'
                if len(ids) > 1: