Merge pull request #413 from eReuse/bugfix/4124-documents-in-lot

fix orther without id
This commit is contained in:
cayop 2022-11-30 11:27:27 +01:00 committed by GitHub
commit f49ba1f7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -172,7 +172,9 @@ class TradeDocument(Thing):
return sorted(ev for ev in actions if ev.severity >= Severity.Warning) return sorted(ev for ev in actions if ev.severity >= Severity.Warning)
def __lt__(self, other): def __lt__(self, other):
return self.id < other.id if self.id and other.id:
return self.id < other.id
return False
def __str__(self) -> str: def __str__(self) -> str:
return '{0.file_name}'.format(self) return '{0.file_name}'.format(self)

View File

@ -2470,6 +2470,7 @@ def test_bug_3831_documents(user3: UserClientFlask):
assert 'Delete Lot' in body assert 'Delete Lot' in body
assert 'Incoming Lot' in body assert 'Incoming Lot' in body
lot_id = Lot.query.all()[1].id
uri = f'/inventory/lot/{lot_id}/trade-document/add/' uri = f'/inventory/lot/{lot_id}/trade-document/add/'
body, status = user3.get(uri) body, status = user3.get(uri)
@ -2487,8 +2488,16 @@ def test_bug_3831_documents(user3: UserClientFlask):
} }
uri = f'/inventory/lot/{lot_id}/trade-document/add/' uri = f'/inventory/lot/{lot_id}/trade-document/add/'
# body, status = user3.post(uri, data=data, content_type="multipart/form-data") body, status = user3.post(uri, data=data, content_type="multipart/form-data")
# assert status == '200 OK' assert status == '200 OK'
# Second document
uri = f'/inventory/lot/{lot_id}/trade-document/add/'
file_upload = (BytesIO(b_file), file_name)
data['file'] = file_upload
data['csrf_token'] = generate_csrf()
body, status = user3.post(uri, data=data, content_type="multipart/form-data")
assert status == '200 OK'
@pytest.mark.mvp @pytest.mark.mvp