InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

Label Printing fails since updating to 0.16.8 and 0.16.9

Open mcsys-dev opened this issue 1 year ago • 10 comments

Please verify that this bug has NOT been raised before.

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

Describe the bug*

The original Setup version was probably 0.15.8. My College told me they have had printed a lot of Labels in the past, and after an update it does not work any more.

We use a Brother QL-1110NWBc for label printing.

Similar-ish issues, but not the same issue:

  • https://github.com/inventree/inventree-brother-plugin/issues/48
  • https://github.com/inventree/InvenTree/issues/7709

Image proof:

Image

Image

Image

Image

Image

Steps to Reproduce

  1. Click on a Part.
  2. To the right of the part there is a qr symbol → click on it → select "Print Label".
  3. In the "Print Label" window, → select a "Template" → select the printing Plugin "InvenTreeLabelMachine" → Select the Machine.
  4. Press "Print"
  5. You get an Error message in both UI's and nothing happens. (There is no where a real error logged. (only in "Background Tasks" under "Failed Tasks"))

Expected behaviour

The Label should get printed.

Deployment Method

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

Version Information

Version Information:

InvenTree-Version: 0.16.9 Django Version: 4.2.15 Commit Hash: e0756a7 Commit Date: 30/11/2024

Database: postgresql Debug-Mode: False Deployed using Docker: True Platform: Linux-6.1.0-28-amd64-x86_64-with Installer: DOC

Active plugins: [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.1.0'}, {'name': 'InvenTreeCoreNotificationsPlugin', 'slug': 'inventreecorenotificationsplugin', 'version': '1.0.0'}, {'name': 'InvenTreeCurrencyExchange', 'slug': 'inventreecurrencyexchange', 'version': '1.0.0'}, {'name': 'InvenTreeLabel', 'slug': 'inventreelabel', 'version': '1.1.0'}, {'name': 'InvenTreeLabelMachine', 'slug': 'inventreelabelmachine', 'version': '1.0.0'}, {'name': 'InvenTreeLabelSheet', 'slug': 'inventreelabelsheet', 'version': '1.0.0'}, {'name': 'DigiKeyPlugin', 'slug': 'digikeyplugin', 'version': '1.0.0'}, {'name': 'LCSCPlugin', 'slug': 'lcscplugin', 'version': '1.0.0'}, {'name': 'MouserPlugin', 'slug': 'mouserplugin', 'version': '1.0.0'}, {'name': 'TMEPlugin', 'slug': 'tmeplugin', 'version': '1.0.0'}, {'name': 'Brother Labels', 'slug': 'brother', 'version': '1.0.0'}]

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

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

Relevant log output

Error Details

invalid literal for int() with base 10: '' : Traceback (most recent call last):

File "/root/.local/lib/python3.11/site-packages/django_q/worker.py", line 97, in worker

res = f(*task["args"], **task["kwargs"])

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/inventree/src/backend/InvenTree/machine/machine_types/label_printer.py", line 81, in print_labels

self.print_label(machine, label, item, **kwargs)

File "/usr/local/lib/python3.11/site-packages/inventree_brother/brother_plugin.py", line 164, in print_label

rotation = int(machine.get_setting('ROTATION', 'D')) + 90

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ValueError: invalid literal for int() with base 10: ''

mcsys-dev avatar Dec 06 '24 13:12 mcsys-dev

@mcsys-dev looks like this was a bug introduced into the label printer plugin

  • See: https://github.com/inventree/inventree-brother-plugin/pull/46#discussion_r1875197230

SchrodingersGat avatar Dec 09 '24 02:12 SchrodingersGat

Your 5) is actually #8511

Regarding the printing driver issue. Do you have a shared cache (redis) as per requirements for the machine registry feature?

wolflu05 avatar Dec 09 '24 08:12 wolflu05

@wolflu05

Regarding the printing driver issue. Do you have a shared cache (redis) as per requirements for the machine registry feature?

No. We use the default Docker-file, but I just noticed that the has docker-file changed. I have now added the changes so that we use the "inventree-cache". But the printing issue is still present.

I couldn't find a section in the stable Docs where requirements for features are listed. (https://docs.inventree.org/en/stable) (There is Redis still listed as disabled by default)

mcsys-dev avatar Dec 09 '24 11:12 mcsys-dev

I couldn't find a section in the stable Docs where requirements for features are listed

I agree, its a bit hidden in the developer docs (extend section).

But the printing issue is still present.

Have you also updated the env file to tell inventree to also use the cache? There are 3 env vars to add for this. If it's still not working after a docker compose down + up. Try connecting to the redis container via docker compose exec -it inventree-cache redis-cli and type MONITOR. You should see keys accessed like: :1:machine:* (e.g. :1:machine:registry:hash or :1:machine:machine:<machine-uuid>:status, when doing something with the machines, e.g. load the machine table, print, ...

wolflu05 avatar Dec 09 '24 11:12 wolflu05

@wolflu05 I have already had updated the .env to reflect the latest change: .env

# Redis cache setup
# Refer to settings.py for other cache options
INVENTREE_CACHE_ENABLED=True
INVENTREE_CACHE_HOST=inventree-cache
INVENTREE_CACHE_PORT=6379

I can see all the different :1:machine:* events that you mentioned. It looks to me if the cache is working as intended. If you want to see some of those entries, let me know.

mcsys-dev avatar Dec 09 '24 12:12 mcsys-dev

Am I understanding this right to be a duplicate of https://github.com/inventree/InvenTree/issues/8511 @wolflu05 ?

matmair avatar Dec 10 '24 12:12 matmair

Not really. There is another issue happening there, but I had no time yet to look into it. It normally should work currently but somehow it doesn't for @mcsys-dev

wolflu05 avatar Dec 10 '24 16:12 wolflu05

I have a short update for you: My College, who uses invenTree regularly, got the Pinter to pint labels. He told me he completely reinstalled and reconfigured (over the ui) the brother plugin and the printer's settings itself. He showed it to me. But still sometimes fails until it works. (not talking about getting both messages: error and success)

Not sure how it was before, but if the printer is in sleep he needs to be turned on manually, and you have to wait a couple of minutes before trying to print. He could not tell me if he changed anything on the printer side.

I hope this somehow helps you. My College is right now happy that he can print some labels again. :)

mcsys-dev avatar Dec 13 '24 08:12 mcsys-dev

Same problem on the last inventree build 0.17.2 (Docker running on Ubuntu)

[!WARNING] Error The label could not be generated

I’m extremely frustrated because every time I try to install a plugin, I encounter installation issues, bugs, or dependency conflicts—whether on Docker, bare metal, Debian, or Ubuntu.

Over the past two weeks, I’ve wasted a lot of time reinstalling Debian 11 nearly ten times, Ubuntu nearly ten times, updating, formatting systems, and dealing with Caddy-related issues. It’s exhausting.

Inventree feels overly complex and heavily dependent on system-level dependencies. Why is that the case?

I do appreciate that it’s an open-source project maintained by dedicated enthusiasts in their free time, but the installation process could really benefit from simplification

gab696 avatar Jan 10 '25 12:01 gab696

I am sorry you are experiencing difficulties. My suggestion would be to select an OS and an install method and sticking to them. Different methods require different steps and switching mostly leads to confusion as the ways to call commands are different and switching them up might result in problems. Bare metal is dependent on system dependencies, docker is not. There a drawbacks and benefits for both. I would recommend docker or the installer for 95% of users

matmair avatar Jan 10 '25 16:01 matmair