[FIX] use correctly datetime objects

bzr revid: mat@openerp.com-20130508115708-ut4jlp572dhxntsd
This commit is contained in:
Martin Trigaux 2013-05-08 13:57:08 +02:00
parent 67b94fa511
commit bf8fc82ecb
1 changed files with 3 additions and 2 deletions

View File

@ -173,8 +173,9 @@ class account_config_settings(osv.osv_memory):
[('date_stop', '<=', time.strftime('%Y-%m-%d')), ('company_id', '=', company_id)])
if past_fiscalyear_ids:
# use the latest fiscal year+1 day, sorted by start_date
latest_stop = self.pool.get('account.fiscalyear').browse(cr, uid, past_fiscalyear_ids[-1], context=context).date_stop
return latest_stop.replace(year= latest_stop.year+1).strftime('%Y-%m-%d')
latest_year = self.pool.get('account.fiscalyear').browse(cr, uid, past_fiscalyear_ids[-1], context=context)
latest_stop = datetime.datetime.strptime(latest_year.date_stop, "%Y-%m-%d")
return latest_stop.replace(year=latest_stop.year+1).strftime('%Y-%m-%d')
else:
return time.strftime('%Y-12-31')