InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

report editor broken in production install

Open wolflu05 opened this issue 8 months ago • 6 comments

Please verify that this bug has NOT been raised before.

  • [x] I checked and didn't find a similar issue

Describe the bug*

When trying to preview a template in the admin center > labe/report templates, I get the following instead of the rendered PDF:

Image

(I have tested with latest chrome and safari)

Not sure why this stopped working, but I am sure this was working a few weeks ago.

Steps to Reproduce

  1. Goto https://demo.inventree.org/web/settings/admin/labels/1/
  2. Click on save & preview
  3. See wrongly shown result

Expected behaviour

The rendered PDF should show

Deployment Method

  • [x] Docker
  • [ ] Package
  • [ ] Bare metal
  • [ ] Other - added info in Steps to Reproduce

Version Information

InvenTree-Version: 0.18.0 dev Django Version: 4.2.20 Commit Hash: c41760a Commit Date: 2025-04-25 Commit Branch: null Database: postgresql Debug-Mode: False Deployed using Docker: True Platform: Linux-5.15.0-100-generic-x86_64-with Installer: DOC Active plugins: false

Please verify if you can reproduce this bug on the demo site.

  • [x] I can reproduce this bug on the demo site.

Relevant log output


wolflu05 avatar Apr 25 '25 17:04 wolflu05

Does normal report printing work properly?

SchrodingersGat avatar Apr 25 '25 22:04 SchrodingersGat

Yes, normal printing from a user's view works as expected, just the preview in the admin center is broken now.

wolflu05 avatar Apr 26 '25 06:04 wolflu05

What is the content of the API response?

SchrodingersGat avatar Apr 26 '25 06:04 SchrodingersGat

Ok, the issue seems, that now somehow there is no output provided when running with a worker in the print response. Therefore the [object object] we were seeing is just the print response itself, as the code thinks thats a pdf.

Image

https://github.com/inventree/InvenTree/blob/9729c41783a24a0fae14001a6396e383ce5c6add/src/frontend/src/components/editors/TemplateEditor/PdfPreview/PdfPreview.tsx#L53-L61

wolflu05 avatar Apr 26 '25 08:04 wolflu05

Oh right because we background the print job now - https://github.com/inventree/InvenTree/pull/9199

So the template editors will need to monitor the printing status and display the output when it completes... Didn't think of that.

There is a hook available which provides this full functionality. Perhaps you might have time to implement this fix?

SchrodingersGat avatar Apr 26 '25 09:04 SchrodingersGat

I have created a PR to fix this, see #9591

wolflu05 avatar Apr 26 '25 09:04 wolflu05