[FIX] Period search should ignore opening/closing periods

This commit is contained in:
Stefan Rijnhart
2012-06-26 11:46:07 +02:00
parent b546f84eef
commit 59016af783
2 changed files with 6 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

@@ -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')