lingo: don't crash sorting invoices that have no creation date (#37208)

This commit is contained in:
Frédéric Péters 2019-10-25 09:49:57 +02:00
parent 0f0353266e
commit 226f93dbd7
1 changed files with 2 additions and 1 deletions

View File

@ -663,7 +663,8 @@ class Items(CellBase):
return ctx
ctx.update({'title': self.title, 'text': self.text})
items = self.get_invoices(user=context['user'])
items.sort(key=lambda i: i.creation_date, reverse=True)
none_date = datetime.datetime(1900, 1, 1) # to avoid None-None comparison errors
items.sort(key=lambda i: i.creation_date or none_date, reverse=True)
ctx.update({'items': items})
return ctx