2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 21:15:41 +00:00

Report image rendering fix (#5907)

* Allow different image variations to be rendered in when using a part image in a report

* Use preview image in default test report

* Fix api_version

- Missed in https://github.com/inventree/InvenTree/pull/5906

* Update docstring

* Add similar functionality for company_image tag

* Update report documentation

* base-64 encode images for rendering in reports

- Allows image manipulation operations to be performed on the images
- Avoids any file pathing issues

* Update docs

* Fix unit tests

* More unit test fixes

* More unit test

* Handle missing file

* Instrument unit test

- Trying to determine what is going on here

* Fix for image resize

* Translate error messages

* Update default report templates

- Specify image size
This commit is contained in:
Oliver
2023-11-14 12:08:18 +11:00
committed by GitHub
parent 3e063750b5
commit 2fcd6ae0b9
13 changed files with 162 additions and 49 deletions

View File

@ -106,7 +106,7 @@ class LabelTest(InvenTreeAPITestCase):
<!-- Test InvenTree URL -->
url: {{ qr_url|safe }}
<!-- Test image URL generation -->
image: {% part_image part %}
image: {% part_image part width=128 %}
<!-- Test InvenTree logo -->
logo: {% logo_image %}
</html>
@ -154,8 +154,9 @@ class LabelTest(InvenTreeAPITestCase):
self.assertIn(f"part: {part_pk} - {part_name}", content)
self.assertIn(f'data: {{"part": {part_pk}}}', content)
self.assertIn(f'http://testserver/part/{part_pk}/', content)
self.assertIn("img/blank_image.png", content)
self.assertIn("img/inventree.png", content)
# Check that a encoded image has been generated
self.assertIn('data:image/png;charset=utf-8;base64,', content)
def test_metadata(self):
"""Unit tests for the metadata field."""