Merge pull request #413 from eReuse/bugfix/4124-documents-in-lot
fix orther without id
This commit is contained in:
commit
f49ba1f7ba
|
@ -172,7 +172,9 @@ class TradeDocument(Thing):
|
|||
return sorted(ev for ev in actions if ev.severity >= Severity.Warning)
|
||||
|
||||
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:
|
||||
return '{0.file_name}'.format(self)
|
||||
|
|
|
@ -2470,6 +2470,7 @@ def test_bug_3831_documents(user3: UserClientFlask):
|
|||
assert 'Delete Lot' in body
|
||||
assert 'Incoming Lot' in body
|
||||
|
||||
lot_id = Lot.query.all()[1].id
|
||||
uri = f'/inventory/lot/{lot_id}/trade-document/add/'
|
||||
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/'
|
||||
# body, status = user3.post(uri, data=data, content_type="multipart/form-data")
|
||||
# assert status == '200 OK'
|
||||
body, status = user3.post(uri, data=data, content_type="multipart/form-data")
|
||||
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
|
||||
|
|
Reference in a new issue