2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-18 10:46:31 +00:00

Label printing bug fixes ()

* 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
This commit is contained in:
Oliver
2024-05-27 19:12:29 +10:00
committed by GitHub
parent 9047e325a9
commit b402836dc4
7 changed files with 42 additions and 31 deletions
docs/docs/report
src
backend
InvenTree
plugin
base
report
stock
frontend
src
components
pages

@@ -147,6 +147,9 @@ class LabelPrintingMixin:
N = len(items)
if N <= 0:
raise ValidationError(_('No items provided to print'))
# Generate a label output for each provided item
for item in items:
context = label.get_context(item, request)
@@ -177,9 +180,13 @@ class LabelPrintingMixin:
self.print_label(**print_args)
else:
# Offload the print task to the background worker
# Exclude the 'pdf_file' object - cannot be pickled
kwargs.pop('pdf_file', None)
# Exclude the 'pdf_file' object - cannot be pickled
print_args.pop('pdf_file', None)
# Exclude the 'context' object - cannot be pickled
print_args.pop('context', None)
offload_task(plugin_label.print_label, self.plugin_slug(), **print_args)
# Update the progress of the print job

@@ -246,7 +246,6 @@ class ReportTemplateBase(MetadataMixin, InvenTree.models.InvenTreeModel):
'base_url': get_base_url(request=request),
'date': InvenTree.helpers.current_date(),
'datetime': InvenTree.helpers.current_time(),
'request': request,
'template': self,
'template_description': self.description,
'template_name': self.name,

@@ -2158,7 +2158,7 @@ class StockItem(
def testResultList(self, **kwargs):
"""Return a list of test-result objects for this StockItem."""
return self.testResultMap(**kwargs).values()
return list(self.testResultMap(**kwargs).values())
def requiredTestStatus(self):
"""Return the status of the tests required for this StockItem.