add reopen transfer
This commit is contained in:
parent
b140dc5f89
commit
21d251e6c0
|
@ -841,6 +841,21 @@ class NewTransferView(GenericMixin):
|
|||
return flask.render_template(self.template_name, **self.context)
|
||||
|
||||
|
||||
class OpenTransferView(GenericMixin):
|
||||
methods = ['GET']
|
||||
|
||||
def dispatch_request(self, lot_id=None):
|
||||
lot = Lot.query.filter_by(id=lot_id).one()
|
||||
next_url = url_for('inventory.lotdevicelist', lot_id=str(lot_id))
|
||||
|
||||
if hasattr(lot, 'transfer'):
|
||||
lot.transfer.date = None
|
||||
db.session.commit()
|
||||
messages.success('Transfer was reopen successfully!')
|
||||
|
||||
return flask.redirect(next_url)
|
||||
|
||||
|
||||
class EditTransferView(GenericMixin):
|
||||
methods = ['POST']
|
||||
form_class = EditTransferForm
|
||||
|
@ -1601,3 +1616,7 @@ devices.add_url_rule(
|
|||
'/device/erasure/<int:orphans>/',
|
||||
view_func=ErasureListView.as_view('device_erasure_list_orphans'),
|
||||
)
|
||||
devices.add_url_rule(
|
||||
'/lot/<string:lot_id>/opentransfer/',
|
||||
view_func=OpenTransferView.as_view('open_transfer'),
|
||||
)
|
||||
|
|
|
@ -516,13 +516,13 @@
|
|||
</div>
|
||||
{% if lot and not lot.is_temporary %}
|
||||
<div id="trade-documents-list" class="tab-pane fade trade-documents-list">
|
||||
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
|
||||
<a href="{{ url_for('inventory.trade_document_add', lot_id=lot.id)}}" class="btn btn-primary">
|
||||
<i class="bi bi-plus"></i>
|
||||
Add new document
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
|
||||
<a href="{{ url_for('inventory.trade_document_add', lot_id=lot.id)}}" class="btn btn-primary">
|
||||
<i class="bi bi-plus"></i>
|
||||
Add new document
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<h5 class="card-title">Documents</h5>
|
||||
<table class="table">
|
||||
|
@ -565,6 +565,15 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="edit-transfer" class="tab-pane fade edit-transfer">
|
||||
{% if form_transfer.date.data %}
|
||||
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
|
||||
<a href="{{ url_for('inventory.open_transfer', lot_id=lot.id)}}" class="btn btn-primary">
|
||||
<i class="bi bi-plus"></i>
|
||||
Reopen a transfer
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h5 class="card-title">Transfer</h5>
|
||||
<form method="post" action="{{ url_for('inventory.edit_transfer', lot_id=lot.id) }}" class="row g-3 needs-validation" novalidate>
|
||||
{{ form_transfer.csrf_token }}
|
||||
|
|
Reference in New Issue