From 347995e9ed25ccef26c615536d8e27066126f343 Mon Sep 17 00:00:00 2001 From: Olivier LAURENT Date: Mon, 2 Sep 2013 16:46:34 +0200 Subject: [PATCH] [FIX] at installation time, avoid the exception 'There is no period defined for this date' --- account_statement_ext/statement.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/account_statement_ext/statement.py b/account_statement_ext/statement.py index 14566ce0..733dbc36 100644 --- a/account_statement_ext/statement.py +++ b/account_statement_ext/statement.py @@ -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):