From 8fda2cf745eb12818b9631c6ff5104c65c563814 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 29 Jan 2021 12:47:46 +1100 Subject: [PATCH] Fixes for unit tests --- InvenTree/stock/models.py | 8 ++++++-- InvenTree/stock/tests.py | 3 ++- InvenTree/stock/views.py | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 51c7bdc39f..57faf2627e 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -1005,11 +1005,15 @@ class StockItem(MPTTModel): new_stock.addTransactionNote( _("Split from existing stock"), user, - _("Split") + f" {helpers.normalize(quantity)} " + _("items") + f"{_('Split')} {helpers.normalize(quantity)} {_('items')}" ) # Remove the specified quantity from THIS stock item - self.take_stock(quantity, user, 'Split {n} items into new stock item'.format(n=quantity)) + self.take_stock( + quantity, + user, + f"{_('Split')} {quantity} {_('items into new stock item')}" + ) # Return a copy of the "new" stock item return new_stock diff --git a/InvenTree/stock/tests.py b/InvenTree/stock/tests.py index b0b05b6326..1461fe8e1a 100644 --- a/InvenTree/stock/tests.py +++ b/InvenTree/stock/tests.py @@ -284,7 +284,8 @@ class StockTest(TestCase): # Check that a tracking item was added track = StockItemTracking.objects.filter(item=it).latest('id') - self.assertIn('Stocktake', track.title) + self.assertIn('Counted', track.title) + self.assertIn('items', track.title) self.assertIn('Counted items', track.notes) n = it.tracking_info.count() diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 11fc76b6e0..0129332d1d 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -1114,7 +1114,7 @@ class StockAdjust(AjaxView, FormMixin): return self.do_delete() else: - return 'No action performed' + return _('No action performed') def do_add(self): @@ -1129,7 +1129,7 @@ class StockAdjust(AjaxView, FormMixin): count += 1 - return _("Added stock to {n} items".format(n=count)) + return f"{_('Added stock to ')} {count} {_('items')}" def do_take(self): @@ -1144,7 +1144,7 @@ class StockAdjust(AjaxView, FormMixin): count += 1 - return _("Removed stock from {n} items".format(n=count)) + return f"{_('Removed stock from ')} {count} {_('items')}" def do_count(self):