Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix weasyprint version #3539

Merged
merged 4 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions InvenTree/label/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,12 @@ def print(self, request, items_to_print):

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()
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()

inline = common.models.InvenTreeUserSetting.get_setting('LABEL_INLINE', user=request.user)

Expand Down
17 changes: 14 additions & 3 deletions InvenTree/label/templates/label/label_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,32 @@
margin: 0mm;
color: #000;
background-color: #FFF;
page-break-before: always;
page-break-after: always;
}

img {
display: inline-block;
image-rendering: pixelated;
}

.content {
width: 100%;
break-after: always;
position: relative;
}

{% block style %}
/* User-defined styles can go here */
{% endblock %}

</style>
</head>

<body>
{% block content %}
<!-- Label data rendered here! -->
{% endblock %}
<div class='content'>
{% block content %}
<!-- Label data rendered here! -->
{% endblock %}
</div>
</body>
15 changes: 5 additions & 10 deletions InvenTree/report/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,12 @@ def print(self, request, items_to_print):
pages = []

try:
for output in outputs:
doc = output.get_document()
for page in doc.pages:
pages.append(page)

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()
pdf = outputs[0].get_document().copy(pages).write_pdf()

except TemplateDoesNotExist as e:

Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -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`
6 changes: 4 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down