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)
|
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):
|
class EditTransferView(GenericMixin):
|
||||||
methods = ['POST']
|
methods = ['POST']
|
||||||
form_class = EditTransferForm
|
form_class = EditTransferForm
|
||||||
|
@ -1601,3 +1616,7 @@ devices.add_url_rule(
|
||||||
'/device/erasure/<int:orphans>/',
|
'/device/erasure/<int:orphans>/',
|
||||||
view_func=ErasureListView.as_view('device_erasure_list_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'),
|
||||||
|
)
|
||||||
|
|
|
@ -565,6 +565,15 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="edit-transfer" class="tab-pane fade edit-transfer">
|
<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>
|
<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 method="post" action="{{ url_for('inventory.edit_transfer', lot_id=lot.id) }}" class="row g-3 needs-validation" novalidate>
|
||||||
{{ form_transfer.csrf_token }}
|
{{ form_transfer.csrf_token }}
|
||||||
|
|
Reference in New Issue