From 59016af7838f3466780a38b13e5a0c5bc7185fa5 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 26 Jun 2012 11:46:07 +0200 Subject: [PATCH 1/2] [FIX] Period search should ignore opening/closing periods --- account_banking/wizard/bank_import.py | 3 ++- account_banking/wizard/banktools.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/account_banking/wizard/bank_import.py b/account_banking/wizard/bank_import.py index af8b8e284..6e2139341 100644 --- a/account_banking/wizard/bank_import.py +++ b/account_banking/wizard/bank_import.py @@ -260,7 +260,8 @@ class banking_import(osv.osv_memory): # Get the period for the statement (as bank statement object checks this) period_ids = period_obj.search(cursor, uid, [('company_id','=',company.id), ('date_start','<=',statement.date), - ('date_stop','>=',statement.date)]) + ('date_stop','>=',statement.date), + ('special', '=', False)]) # Create the bank statement record statement_id = statement_obj.create(cursor, uid, dict( diff --git a/account_banking/wizard/banktools.py b/account_banking/wizard/banktools.py index 9cd3b014a..37415e21a 100644 --- a/account_banking/wizard/banktools.py +++ b/account_banking/wizard/banktools.py @@ -69,9 +69,12 @@ def get_period(pool, cursor, uid, date, company, log): return False fiscalyear_id = fiscalyear_ids[0] + import pdb + pdb.set_trace() period_ids = period_obj.search(cursor, uid, [ ('date_start','<=',search_date), ('date_stop','>=',search_date), - ('fiscalyear_id','=',fiscalyear_id), ('state','=','draft') + ('fiscalyear_id','=',fiscalyear_id), ('state','=','draft'), + ('special', '=', False), ]) if not period_ids: log.append(_('No suitable period found for date %(date)s and company %(company_name)s') From d6334df3698e581d8ec1859bb3a64559c1584748 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 26 Jun 2012 13:17:32 +0200 Subject: [PATCH 2/2] [FIX] remove call to debugger --- account_banking/wizard/banktools.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/account_banking/wizard/banktools.py b/account_banking/wizard/banktools.py index 37415e21a..cebf60259 100644 --- a/account_banking/wizard/banktools.py +++ b/account_banking/wizard/banktools.py @@ -69,8 +69,6 @@ def get_period(pool, cursor, uid, date, company, log): return False fiscalyear_id = fiscalyear_ids[0] - import pdb - pdb.set_trace() period_ids = period_obj.search(cursor, uid, [ ('date_start','<=',search_date), ('date_stop','>=',search_date), ('fiscalyear_id','=',fiscalyear_id), ('state','=','draft'),