[FIX] next report date and no need for hr in gamification

bzr revid: mat@openerp.com-20130313102614-7abnizlqwq73pjqu
This commit is contained in:
Martin Trigaux 2013-03-13 11:26:14 +01:00
parent e0b0bd2c14
commit c36cd97b79
2 changed files with 20 additions and 20 deletions

View File

@ -23,7 +23,7 @@
'version': '1.0',
'author': 'OpenERP SA',
'category': 'Human Resources',
'depends': ['mail', 'hr'],
'depends': ['mail'],
'description': """Gamification of goals""",
'data': [

View File

@ -76,17 +76,17 @@ class gamification_goal_plan(osv.Model):
for plan in self.browse(cr, uid, ids, context):
last = datetime.strptime(plan.last_report_date, '%Y-%m-%d').date()
if plan.report_message_frequency == 'daily':
next = last + timedelta(days=1)
res[plan.id] = last + timedelta(days=1).isoformat()
elif plan.report_message_frequency == 'weekly':
next = last + timedelta(days=7)
res[plan.id] = last + timedelta(days=7).isoformat()
elif plan.report_message_frequency == 'monthly':
month_range = calendar.monthrange(last.year, last.month)
next = last.replace(day=month_range[1]) + timedelta(days=1)
res[plan.id] = last.replace(day=month_range[1]) + timedelta(days=1).isoformat()
elif plan.report_message_frequency == 'yearly':
next = last.replace(year=last.year + 1)
res[plan.id] = last.replace(year=last.year + 1).isoformat()
else: # frequency == 'once':
next = False
res[plan.id] = next.isoformat()
res[plan.id] = False
return res
_columns = {