Skip to content

'LabelTemplate' object has no attribute 'object_to_print' when trying to print/generate label #1

@lenielsen

Description

@lenielsen

Hey,
I'm struggling to get the plugin to work. Once activated, I am not able to generate / print any labels no matter which template Im using.

`
Traceback (most recent call last):

File "/home/inventree/src/backend/InvenTree/report/api.py", line 271, in print
plugin.print_labels(

File "/home/inventree/src/backend/InvenTree/plugin/base/label/mixins.py", line 155, in print_labels
context = label.get_context(item, request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/inventree/src/backend/InvenTree/report/models.py", line 411, in get_context
plugin.add_label_context(self, self.object_to_print, request, context)
^^^^^^^^^^^^^^^^^^^^

`AttributeError: 'LabelTemplate' object has no attribute 'object_to_print'``

Disabling the plugin fixes the issue.

I have tried to import the example 29mm template. Same result. The issue also appears when trying to use PlatformUI's label preview feature.

# Version Information:
InvenTree-Version: 0.16.0 dev
Django Version: 4.2.12
Commit Hash: 79ea689
Commit Date: 2024-06-16

Database: postgresql
Debug-Mode: False
Deployed using Docker: True
Platform: Linux-6.8.0-76060800daily20240311-generic-x86_64-with
Installer: DOC

Active plugins: [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.0.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': '0.9.0'}, {'name': 'PartTemplatesPlugin', 'slug': 'part-templates', 'version': '0.3.1'}]

Is the plugin compatible with the latest version or only stable? I havent tried the latter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions