Add interleaved shipping labels printing

master
informatic 2020-04-29 14:43:39 +02:00
parent 116227ca92
commit c14e01c764
3 changed files with 16 additions and 9 deletions

View File

@ -464,7 +464,12 @@ class FaceshieldRequestAdmin(ModelView):
@flask_admin.actions.action('shipping_print', 'Kurjerzy / Print shipping labels')
def action_shipping_print(self, ids):
models = self.get_query().filter(FaceshieldRequest.id.in_(ids)).all()
return render_pdf(HTML(string=self.render('shipping_label.html', models=models)))
return render_pdf(HTML(string=self.render('shipping_label.html', models=models, interleaved=False)))
@flask_admin.actions.action('shipping_print_interleaved', 'Kurjerzy / Print shipping labels (interleaved)')
def action_shipping_print_interleaved(self, ids):
models = self.get_query().filter(FaceshieldRequest.id.in_(ids)).all()
return render_pdf(HTML(string=self.render('shipping_label.html', models=models, interleaved=True)))
@flask_admin.actions.action('shipping_refresh', 'Shipping / Refresh tracking info')
def action_shipping_refresh(self, ids):

View File

@ -68,6 +68,7 @@ html, body {
<body>
{% block content %}
{% for model in models %}
{% block model_labels scoped %}
{% for label_id in range(model.label_count) %}
<div class="container">
<div class="line idline">
@ -85,6 +86,7 @@ html, body {
</div>
</div>
{% endfor %}
{% endblock %}
{% endfor %}
{% endblock %}
</body>

View File

@ -14,14 +14,14 @@ overflow: hidden;
height: 100%;
}
{% endblock %}
{% block content %}
{% for model in models %}
{% for shipment in model.shipping_info %}
<div class="container shipping">
<div class="inner">
<img src="{{ shipment['labelSource'] }}" alt="label {{ model.id }}" />
</div>
{% block model_labels scoped %}
{% if interleaved %}{{ super() }}{% endif %}
{% for shipment in model.shipping_info %}
<div class="container shipping">
<div class="inner">
<img src="{{ shipment['labelSource'] }}" alt="label {{ model.id }}" />
</div>
{% endfor %}
</div>
{% endfor %}
{% endblock %}