mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix weasyprint version (#3539)
* Pin weasyprint version - Revert to 54.3 - Fixes https://github.com/inventree/InvenTree/issues/3528 * Simplify label printing for multiple pages * Simplify PDF generation for multiple report outputs * Add content wrapper div for base label template - Allows more extensibility
This commit is contained in:
parent
00dbf00eb9
commit
87e7112326
@ -158,16 +158,12 @@ class LabelPrintMixin:
|
||||
|
||||
pages = []
|
||||
|
||||
if len(outputs) > 1:
|
||||
# If more than one output is generated, merge them into a single file
|
||||
for output in outputs:
|
||||
doc = output.get_document()
|
||||
for page in doc.pages:
|
||||
pages.append(page)
|
||||
|
||||
pdf = outputs[0].get_document().copy(pages).write_pdf()
|
||||
else:
|
||||
pdf = outputs[0].get_document().write_pdf()
|
||||
|
||||
inline = common.models.InvenTreeUserSetting.get_setting('LABEL_INLINE', user=request.user)
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
margin: 0mm;
|
||||
color: #000;
|
||||
background-color: #FFF;
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
}
|
||||
|
||||
img {
|
||||
@ -22,14 +24,23 @@
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
break-after: always;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
{% block style %}
|
||||
/* User-defined styles can go here */
|
||||
{% endblock %}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='content'>
|
||||
{% block content %}
|
||||
<!-- Label data rendered here! -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
@ -233,17 +233,12 @@ class ReportPrintMixin:
|
||||
pages = []
|
||||
|
||||
try:
|
||||
|
||||
if len(outputs) > 1:
|
||||
# If more than one output is generated, merge them into a single file
|
||||
for output in outputs:
|
||||
doc = output.get_document()
|
||||
for page in doc.pages:
|
||||
pages.append(page)
|
||||
|
||||
pdf = outputs[0].get_document().copy(pages).write_pdf()
|
||||
else:
|
||||
pdf = outputs[0].get_document().write_pdf()
|
||||
|
||||
except TemplateDoesNotExist as e:
|
||||
|
||||
|
@ -33,6 +33,7 @@ rapidfuzz==0.7.6 # Fuzzy string matching
|
||||
sentry-sdk # Error reporting (optional)
|
||||
setuptools # Standard depenedency
|
||||
tablib[xls,xlsx,yaml] # Support for XLS and XLSX formats
|
||||
weasyprint==54.3 # PDF generation
|
||||
|
||||
# Fixed sub-dependencies
|
||||
py-moneyed<2.0 # For django-money # FIXED 2022-06-18 as we need `moneyed.localization`
|
||||
|
@ -230,8 +230,10 @@ urllib3==1.26.11
|
||||
# sentry-sdk
|
||||
wcwidth==0.2.5
|
||||
# via blessed
|
||||
weasyprint==56.1
|
||||
# via django-weasyprint
|
||||
weasyprint==54.3
|
||||
# via
|
||||
# -r requirements.in
|
||||
# django-weasyprint
|
||||
webencodings==0.5.1
|
||||
# via
|
||||
# bleach
|
||||
|
Loading…
Reference in New Issue
Block a user