+ def _default_date_from(self,cr, uid, context={}):
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ r = user.company_id.timesheet_range
+ if r=='month':
+ return time.strftime('%Y-%m-01')
+ elif r=='week':
+ return (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Monday,0))).strftime('%Y-%m-%d')
+ elif r=='year':
+ return time.strftime('%Y-01-01')
+ return time.strftime('%Y-%m-%d')
+ def _default_date_to(self,cr, uid, context={}):
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ r = user.company_id.timesheet_range
+ if r=='month':
+ return (DateTime.now() + DateTime.RelativeDateTime(months=+1,day=1,days=-1)).strftime('%Y-%m-%d')
+ elif r=='week':
+ return (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Sunday,0))).strftime('%Y-%m-%d')
+ elif r=='year':
+ return time.strftime('%Y-12-31')
+ return time.strftime('%Y-%m-%d')