Skip to content

Label printing bug fixes - #7329

Merged
SchrodingersGat merged 8 commits into
inventree:masterfrom
SchrodingersGat:label-pickle-fix
May 27, 2024
Merged

SchrodingersGat merged 8 commits into
inventree:masterfrom
SchrodingersGat:label-pickle-fix

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented May 24, 2024 •

Copy link
Copy Markdown
Member

Addresses some bugs in label printing framework.

Note (to self)

  • The "offload printing" method in the label plugin framework currently errors out
  • Due to "pickling" error (see below)
  • Requires further investigation

image

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed plugin Plugin ecosystem report Report/Label generation labels May 24, 2024
@SchrodingersGat SchrodingersGat added this to the 0.16.0 milestone May 24, 2024
@SchrodingersGat
SchrodingersGat requested a review from matmair as a code owner May 24, 2024 14:23
@netlify

netlify Bot commented May 24, 2024 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit c71ef17
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/665448d35e45c3000800426d

@wolflu05

Copy link
Copy Markdown
Member

That Pickering error is exactly #6772. and that's why I think the request object should not be part of the rendering methods. Because rendering should be done in the background. But that only works if the request (which obviously cannot be pickeld) is not in the arguments passed to the worker.

@codecov

codecov Bot commented May 24, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 30.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 82.70%. Comparing base (0c56bd8) to head (c71ef17).
Report is 328 commits behind head on master.

Files Patch % Lines
src/backend/InvenTree/plugin/base/label/mixins.py 25.00% 3 Missing ⚠️
...rontend/src/components/buttons/PrintingActions.tsx 25.00% 3 Missing ⚠️
src/frontend/src/components/forms/ApiForm.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7329      +/-   ##
==========================================
- Coverage   83.78%   82.70%   -1.08%     
==========================================
  Files        1049     1049              
  Lines       46005    46850     +845     
  Branches     1386     1387       +1     
==========================================
+ Hits        38544    38748     +204     
- Misses       7098     7741     +643     
+ Partials      363      361       -2     
Flag Coverage Δ
backend 85.14% <40.00%> (+<0.01%) ⬆️
pui 65.12% <20.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wolflu05

Copy link
Copy Markdown
Member

@SchrodingersGat @matmair what do you think on that: #7329 (comment) ?

TL;DR I think rendering a label/report template should be done on a background worker for performance and architecture reasons. But that requires we completely strip out the request object from the args/kwargs as the request object cannot be pickelt. (That would also solve part of #6772)

@SchrodingersGat
SchrodingersGat enabled auto-merge (squash) May 27, 2024 09:10
@SchrodingersGat
SchrodingersGat merged commit b402836 into inventree:master May 27, 2024
@SchrodingersGat

Copy link
Copy Markdown
Member Author

@wolflu05 I am completely on board to remove the request object entirely, and allow label printing to be done entirely in the background worker thread. To achieve this we would have to change what we pass through - in fact all we need to pass through is:

  • The LabelTempltae ID
  • The slug of the plugin
  • The pk values of the model instances to be printed
  • The pk of the user

@SchrodingersGat
SchrodingersGat deleted the label-pickle-fix branch May 27, 2024 09:12
martonmiklos pushed a commit to martonmiklos/InvenTree that referenced this pull request Jun 24, 2024
* Hide printing actions button for top level stock location

* Fix typo

* Add another check for null

* Remove debug statement

* Prevent display of multiple form-error notifications

* Fix pickling for print offloading

* Reset selected plugin

* Exclude the entire 'context' object when pickling a printing job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Identifies a bug which needs to be addressed plugin Plugin ecosystem report Report/Label generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants