inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.32k stars 781 forks source link

'LabelTemplate' object has no attribute 'object_to_print' #7546

Closed SergeoLacruz closed 4 months ago

SergeoLacruz commented 4 months ago

Please verify that this bug has NOT been raised before.

Describe the bug*

Label printing shown Form errors as shown in the enclosed screenshot. I tried with different label templates and printer settings. Always the same.

Steps to Reproduce

Select a part print a pabel label

Expected behaviour

usually a popup comes with the label

Deployment Method

Version Information

InvenTree Version 0.16.0 dev Development Version Commit Hash ade6cfb Commit Date 2024-07-02 Commit Branch master

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

Relevant log output

Event triggered: 'report_labeloutput.created'
Enqueued [InvenTree] 692062
Pushed ('artist-eight-twelve-cup', 'df01ff2b7d6d426992530b28fb9f5b11')
Event triggered: 'report_labeloutput.saved'
Enqueued [InvenTree] 692063
Pushed ('winner-east-echo-india', '7703b83a73b441be8ad721452c343a41')
Checking plugin registry hash
'LabelTemplate' object has no attribute 'object_to_print'
Gathering users for notification 'inventree.error_log'
Sending notification 'inventree.error_log' for 'Error object (333)'
Triggering notification method 'ui_message'
Notify users via 'ui_message' for notification 'inventree.error_log' for 'Error object (333)'
Notified 7 users via 'ui_message' for notification 'inventree.error_log' for 'Error object (333)' successfully
Bad Request: /api/label/print/
Bad Request: /api/label/print/
[02/Jul/2024 06:02:32] "POST /api/label/print/ HTTP/1.1" 400 105
[02/Jul/2024 06:02:32] "GET /api/notifications/?read=false HTTP/1.1" 200 14435

raceback (most recent call last):

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

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

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

AttributeError: 'LabelTemplate' object has no attribute 'object_to_print'
SchrodingersGat commented 4 months ago

@SergeoLacruz thanks for reporting this, fix incoming in https://github.com/inventree/InvenTree/pull/7548