2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-28 03:26:45 +00:00

Cleanup backend code (#9158)

* Cleanup backend code

* Re-add # TODO
This commit is contained in:
Oliver 2025-02-23 17:51:51 +11:00 committed by GitHub
parent 56de14610f
commit 9d1d0fa66b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1 additions and 21 deletions

View File

@ -19,7 +19,6 @@ def is_worker_running(**kwargs):
clusters = Stat.get_all()
if len(clusters) > 0:
# TODO - Introspect on any cluster information
return True
"""

View File

@ -275,11 +275,6 @@ class TestLabelPrinterMachineType(TestMachineRegistryMixin, InvenTreeAPITestCase
self.assertEqual(self.print_labels.call_args.args[0], self.machine.machine)
self.assertEqual(self.print_labels.call_args.args[1], template)
# TODO re-activate test
# self.assertQuerySetEqual(
# self.print_labels.call_args.args[2], parts, transform=lambda x: x
# )
self.assertIn('printing_options', self.print_labels.call_args.kwargs)
self.assertEqual(
self.print_labels.call_args.kwargs['printing_options'],

View File

@ -1278,13 +1278,7 @@ class StockItem(
def is_allocated(self):
"""Return True if this StockItem is allocated to a SalesOrder or a Build."""
# TODO - For now this only checks if the StockItem is allocated to a SalesOrder
# TODO - In future, once the "build" is working better, check this too
if self.allocations.count() > 0:
return True
return self.sales_order_allocations.count() > 0
return self.allocation_count() > 0
def build_allocation_count(self, **kwargs):
"""Return the total quantity allocated to builds, with optional filters."""
@ -1469,8 +1463,6 @@ class StockItem(
if self.belongs_to is None:
return False
# TODO - Are there any other checks that need to be performed at this stage?
# Add a transaction note to the parent item
self.belongs_to.add_tracking_entry(
StockHistoryCode.REMOVED_CHILD_ITEM,
@ -2403,9 +2395,6 @@ class StockItem(
"""Remove all test results."""
# All test results
results = self.test_results.all()
# TODO - Perhaps some filtering options supplied by kwargs?
results.delete()
def getTestResults(self, template=None, test=None, result=None, user=None):

View File

@ -68,7 +68,6 @@ class RuleSetInline(admin.TabularInline):
max_num = len(RuleSet.RULESET_CHOICES)
min_num = 1
extra = 0
# TODO: find better way to order inlines
ordering = ['name']

View File

@ -51,8 +51,6 @@ def default_token():
def default_token_expiry():
"""Generate an expiry date for a newly created token."""
# TODO: Custom value for default expiry timeout
# TODO: For now, tokens last for 1 year
return InvenTree.helpers.current_date() + datetime.timedelta(days=365)