[FIX] at installation time, avoid the exception 'There is no period defined for this date'

This commit is contained in:
Olivier LAURENT
2013-09-02 16:46:34 +02:00
parent bd85ba2e28
commit 347995e9ed

View File

@@ -553,7 +553,11 @@ class AccountBankSatementLine(Model):
if context is None:
context = {}
date = context.get('date')
periods = self.pool.get('account.period').find(cr, uid, dt=date)
try:
periods = self.pool.get('account.period').find(cr, uid, dt=date)
except osv.except_osv:
# if no period defined, we are certainly at installation time
return False
return periods and periods[0] or False
def _get_default_account(self, cr, uid, context=None):