[FIX] Period search should ignore opening/closing periods

This commit is contained in:
Stefan Rijnhart
2012-07-09 19:28:54 +02:00
2 changed files with 4 additions and 2 deletions

View File

@@ -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(

View File

@@ -71,7 +71,8 @@ def get_period(pool, cursor, uid, date, company, log):
fiscalyear_id = fiscalyear_ids[0]
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')