Commit fe9996d3 by Damien Moulard

add try/except for error case

parent 3f1b6284
......@@ -196,8 +196,12 @@ class CagetteEnvelops(models.Model):
else:
# Get the oldest check envelops, limited by the number of checks
docs = []
for item in c_db.dbc.view('index/by_type_not_archive', key='ch', include_docs=True, limit=payment_data['checks_nb']):
docs.append(item.doc)
try:
for item in c_db.dbc.view('index/by_type_not_archive', key='ch', include_docs=True, limit=payment_data['checks_nb']):
docs.append(item.doc)
except:
# Exception raised if no envelop
pass
# If only 1 check to save
if int(payment_data['checks_nb']) == 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment