From 1887463f7fd48e9b949c952a32c3b0779de89b36 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 4 Nov 2019 21:55:48 +1100 Subject: [PATCH 1/9] Properly display 'notes' field in grouped rows for stock table --- .../static/script/inventree/stock.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index e4582e879e..44a5aeaff4 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -125,6 +125,28 @@ function loadStockTable(table, options) { // A single location! return renderLink(row.location__path, '/stock/location/' + row.location + '/') } + } else if (field == 'notes') { + var notes = []; + + data.forEach(function(item) { + var note = item.notes; + + if (!note || note == '') { + note = '-'; + } + + if (!notes.includes(note)) { + notes.push(note); + } + }); + + if (notes.length > 1) { + return '...'; + } else if (notes.length == 1) { + return notes[0] || '-'; + } else { + return '-'; + } } else { return ''; From ce6f54aeaae9fcd98fbe7c9e9d6c17f62beb846b Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 5 Nov 2019 20:23:15 +1100 Subject: [PATCH 2/9] Lock specific version of coverage --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0f94e4cc14..50fc083494 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ django-import-export>=1.0.0 # Data import / export for admin interface django-cleanup>=2.1.0 # Manage deletion of old / unused uploaded files django-qr-code==1.0.0 # Generate QR codes flake8==3.3.0 # PEP checking -coverage>=4.5.3 # Unit test coverage +coverage==4.0.3 # Unit test coverage python-coveralls==2.9.1 # Coveralls linking (for Travis) fuzzywuzzy>=0.17.0 # Fuzzy string matching python-Levenshtein>=0.12.0 # Required for fuzzywuzzy \ No newline at end of file From 56255a98d8bbc4c8db27c93814418c35416bc297 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 19:28:47 +1100 Subject: [PATCH 3/9] Add a menu item to delete multiple stock items --- InvenTree/templates/stock_table.html | 1 + 1 file changed, 1 insertion(+) diff --git a/InvenTree/templates/stock_table.html b/InvenTree/templates/stock_table.html index c5d16b8ed6..b3b214c031 100644 --- a/InvenTree/templates/stock_table.html +++ b/InvenTree/templates/stock_table.html @@ -12,6 +12,7 @@
  • Count stock
  • Move stock
  • Order stock
  • +
  • Delete Stock
  • From 339126b27adeab175a9168986a411b7239d3d393 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 19:41:36 +1100 Subject: [PATCH 4/9] Add new field "active" to StockItem model - True by default - Set to 'false' to mark a stockitem as 'deleted' --- .../stock/migrations/0016_stockitem_active.py | 18 ++++++++++++++++++ InvenTree/stock/models.py | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 InvenTree/stock/migrations/0016_stockitem_active.py diff --git a/InvenTree/stock/migrations/0016_stockitem_active.py b/InvenTree/stock/migrations/0016_stockitem_active.py new file mode 100644 index 0000000000..1fb317a307 --- /dev/null +++ b/InvenTree/stock/migrations/0016_stockitem_active.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.5 on 2019-11-16 08:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0015_auto_20190913_1407'), + ] + + operations = [ + migrations.AddField( + model_name='stockitem', + name='active', + field=models.BooleanField(default=True), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 1cf1a870b8..7edd161b69 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -121,6 +121,7 @@ class StockItem(models.Model): build: Link to a Build (if this stock item was created from a build) purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder) infinite: If True this StockItem can never be exhausted + active: True (by default) unless the StockItem has been 'deleted' """ def save(self, *args, **kwargs): @@ -357,13 +358,15 @@ class StockItem(models.Model): choices=StockStatus.items(), validators=[MinValueValidator(0)]) - notes = models.CharField(max_length=250, blank=True, help_text='Stock Item Notes') + notes = models.CharField(max_length=250, blank=True, help_text=_('Stock Item Notes')) # If stock item is incoming, an (optional) ETA field # expected_arrival = models.DateField(null=True, blank=True) infinite = models.BooleanField(default=False) + active = models.BooleanField(default=True) + def can_delete(self): """ Can this stock item be deleted? It can NOT be deleted under the following circumstances: From 0effb584b97c0f6e6877456148a5424ec25658cf Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 20:13:51 +1100 Subject: [PATCH 5/9] Remove 'active' field - Will work this change in at a later date --- InvenTree/stock/models.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 7edd161b69..3f56b2e885 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -121,7 +121,6 @@ class StockItem(models.Model): build: Link to a Build (if this stock item was created from a build) purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder) infinite: If True this StockItem can never be exhausted - active: True (by default) unless the StockItem has been 'deleted' """ def save(self, *args, **kwargs): @@ -365,8 +364,6 @@ class StockItem(models.Model): infinite = models.BooleanField(default=False) - active = models.BooleanField(default=True) - def can_delete(self): """ Can this stock item be deleted? It can NOT be deleted under the following circumstances: From 789515e39db6d3a5d1f822b2b1b647f5167e81c0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 20:14:08 +1100 Subject: [PATCH 6/9] Add translations for the StockItem detail page --- InvenTree/locale/de/LC_MESSAGES/django.po | 161 +++++++++++++++++----- InvenTree/locale/en/LC_MESSAGES/django.po | 161 +++++++++++++++++----- InvenTree/locale/es/LC_MESSAGES/django.po | 161 +++++++++++++++++----- InvenTree/stock/templates/stock/item.html | 41 +++--- 4 files changed, 411 insertions(+), 113 deletions(-) diff --git a/InvenTree/locale/de/LC_MESSAGES/django.po b/InvenTree/locale/de/LC_MESSAGES/django.po index de659e0f1f..d12aa130ba 100644 --- a/InvenTree/locale/de/LC_MESSAGES/django.po +++ b/InvenTree/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-27 00:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:12+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:834 +#: build/views.py:289 stock/views.py:848 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -190,6 +190,10 @@ msgstr "" msgid "Use this currency as the base currency" msgstr "" +#: company/templates/company/partdelete.html:5 +msgid "Are you sure you want to delete the following Supplier Parts?" +msgstr "" + #: order/forms.py:21 msgid "Place order" msgstr "" @@ -223,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:437 +#: stock/models.py:438 msgid "Quantity must be greater than zero" msgstr "" @@ -247,7 +251,7 @@ msgstr "" msgid "Line item notes" msgstr "" -#: order/models.py:275 +#: order/models.py:275 stock/templates/stock/item.html:106 msgid "Purchase Order" msgstr "" @@ -409,7 +413,7 @@ msgstr "" msgid "Variant Of" msgstr "" -#: part/templates/part/detail.html:49 +#: part/templates/part/detail.html:49 stock/templates/stock/item.html:118 msgid "URL" msgstr "" @@ -497,7 +501,7 @@ msgstr "" msgid "Part cannot be sold to customers" msgstr "" -#: part/templates/part/detail.html:151 +#: part/templates/part/detail.html:151 stock/templates/stock/item.html:150 msgid "Notes" msgstr "" @@ -554,67 +558,142 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:201 +#: stock/models.py:202 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:206 +#: stock/models.py:207 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:225 +#: stock/models.py:226 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:235 stock/models.py:244 +#: stock/models.py:236 stock/models.py:245 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:236 +#: stock/models.py:237 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:252 +#: stock/models.py:253 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:261 +#: stock/models.py:262 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:434 +#: stock/models.py:361 +msgid "Stock Item Notes" +msgstr "" + +#: stock/models.py:435 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:440 +#: stock/models.py:441 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:443 stock/models.py:446 +#: stock/models.py:444 stock/models.py:447 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:449 +#: stock/models.py:450 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:459 +#: stock/models.py:460 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:480 +#: stock/models.py:481 msgid "Add serial number" msgstr "" -#: stock/models.py:483 +#: stock/models.py:484 #, python-brace-format msgid "Serialized {n} items" msgstr "" +#: stock/templates/stock/item.html:8 +msgid "Stock Item Details" +msgstr "" + +#: stock/templates/stock/item.html:51 +msgid "" +"This stock item is serialized - it has a unique serial number and the " +"quantity cannot be adjusted." +msgstr "" + +#: stock/templates/stock/item.html:55 +msgid "" +"This stock item will be automatically deleted when all stock is depleted." +msgstr "" + +#: stock/templates/stock/item.html:72 +msgid "Belongs To" +msgstr "" + +#: stock/templates/stock/item.html:77 +msgid "Location" +msgstr "" + +#: stock/templates/stock/item.html:83 +msgid "Serial Number" +msgstr "" + +#: stock/templates/stock/item.html:88 +msgid "Quantity" +msgstr "" + +#: stock/templates/stock/item.html:94 +msgid "Batch" +msgstr "" + +#: stock/templates/stock/item.html:100 +msgid "Build" +msgstr "" + +#: stock/templates/stock/item.html:112 +msgid "Customer" +msgstr "" + +#: stock/templates/stock/item.html:124 +msgid "Supplier" +msgstr "" + +#: stock/templates/stock/item.html:128 +msgid "Supplier Part" +msgstr "" + +#: stock/templates/stock/item.html:133 +msgid "Last Updated" +msgstr "" + +#: stock/templates/stock/item.html:137 +msgid "Last Stocktake" +msgstr "" + +#: stock/templates/stock/item.html:141 +msgid "No stocktake performed" +msgstr "" + +#: stock/templates/stock/item.html:145 +msgid "Status" +msgstr "" + +#: stock/templates/stock/item.html:159 +msgid "Stock Tracking Information" +msgstr "" + #: stock/templates/stock/location.html:37 msgid "Location Details" msgstr "" @@ -644,51 +723,71 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:399 +#: stock/views.py:370 +msgid "Move Stock Items" +msgstr "" + +#: stock/views.py:371 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:372 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:373 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:374 +msgid "Delete Stock Items" +msgstr "" + +#: stock/views.py:401 msgid "Must enter integer value" msgstr "" -#: stock/views.py:404 +#: stock/views.py:406 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:411 +#: stock/views.py:413 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:419 +#: stock/views.py:421 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:487 +#: stock/views.py:492 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:502 +#: stock/views.py:507 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:515 +#: stock/views.py:520 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:543 +#: stock/views.py:548 msgid "No items were moved" msgstr "" -#: stock/views.py:546 +#: stock/views.py:551 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:813 +#: stock/views.py:827 msgid "Invalid part selection" msgstr "" -#: stock/views.py:875 +#: stock/views.py:889 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/locale/en/LC_MESSAGES/django.po b/InvenTree/locale/en/LC_MESSAGES/django.po index de659e0f1f..d12aa130ba 100644 --- a/InvenTree/locale/en/LC_MESSAGES/django.po +++ b/InvenTree/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-27 00:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:12+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:834 +#: build/views.py:289 stock/views.py:848 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -190,6 +190,10 @@ msgstr "" msgid "Use this currency as the base currency" msgstr "" +#: company/templates/company/partdelete.html:5 +msgid "Are you sure you want to delete the following Supplier Parts?" +msgstr "" + #: order/forms.py:21 msgid "Place order" msgstr "" @@ -223,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:437 +#: stock/models.py:438 msgid "Quantity must be greater than zero" msgstr "" @@ -247,7 +251,7 @@ msgstr "" msgid "Line item notes" msgstr "" -#: order/models.py:275 +#: order/models.py:275 stock/templates/stock/item.html:106 msgid "Purchase Order" msgstr "" @@ -409,7 +413,7 @@ msgstr "" msgid "Variant Of" msgstr "" -#: part/templates/part/detail.html:49 +#: part/templates/part/detail.html:49 stock/templates/stock/item.html:118 msgid "URL" msgstr "" @@ -497,7 +501,7 @@ msgstr "" msgid "Part cannot be sold to customers" msgstr "" -#: part/templates/part/detail.html:151 +#: part/templates/part/detail.html:151 stock/templates/stock/item.html:150 msgid "Notes" msgstr "" @@ -554,67 +558,142 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:201 +#: stock/models.py:202 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:206 +#: stock/models.py:207 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:225 +#: stock/models.py:226 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:235 stock/models.py:244 +#: stock/models.py:236 stock/models.py:245 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:236 +#: stock/models.py:237 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:252 +#: stock/models.py:253 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:261 +#: stock/models.py:262 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:434 +#: stock/models.py:361 +msgid "Stock Item Notes" +msgstr "" + +#: stock/models.py:435 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:440 +#: stock/models.py:441 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:443 stock/models.py:446 +#: stock/models.py:444 stock/models.py:447 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:449 +#: stock/models.py:450 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:459 +#: stock/models.py:460 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:480 +#: stock/models.py:481 msgid "Add serial number" msgstr "" -#: stock/models.py:483 +#: stock/models.py:484 #, python-brace-format msgid "Serialized {n} items" msgstr "" +#: stock/templates/stock/item.html:8 +msgid "Stock Item Details" +msgstr "" + +#: stock/templates/stock/item.html:51 +msgid "" +"This stock item is serialized - it has a unique serial number and the " +"quantity cannot be adjusted." +msgstr "" + +#: stock/templates/stock/item.html:55 +msgid "" +"This stock item will be automatically deleted when all stock is depleted." +msgstr "" + +#: stock/templates/stock/item.html:72 +msgid "Belongs To" +msgstr "" + +#: stock/templates/stock/item.html:77 +msgid "Location" +msgstr "" + +#: stock/templates/stock/item.html:83 +msgid "Serial Number" +msgstr "" + +#: stock/templates/stock/item.html:88 +msgid "Quantity" +msgstr "" + +#: stock/templates/stock/item.html:94 +msgid "Batch" +msgstr "" + +#: stock/templates/stock/item.html:100 +msgid "Build" +msgstr "" + +#: stock/templates/stock/item.html:112 +msgid "Customer" +msgstr "" + +#: stock/templates/stock/item.html:124 +msgid "Supplier" +msgstr "" + +#: stock/templates/stock/item.html:128 +msgid "Supplier Part" +msgstr "" + +#: stock/templates/stock/item.html:133 +msgid "Last Updated" +msgstr "" + +#: stock/templates/stock/item.html:137 +msgid "Last Stocktake" +msgstr "" + +#: stock/templates/stock/item.html:141 +msgid "No stocktake performed" +msgstr "" + +#: stock/templates/stock/item.html:145 +msgid "Status" +msgstr "" + +#: stock/templates/stock/item.html:159 +msgid "Stock Tracking Information" +msgstr "" + #: stock/templates/stock/location.html:37 msgid "Location Details" msgstr "" @@ -644,51 +723,71 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:399 +#: stock/views.py:370 +msgid "Move Stock Items" +msgstr "" + +#: stock/views.py:371 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:372 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:373 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:374 +msgid "Delete Stock Items" +msgstr "" + +#: stock/views.py:401 msgid "Must enter integer value" msgstr "" -#: stock/views.py:404 +#: stock/views.py:406 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:411 +#: stock/views.py:413 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:419 +#: stock/views.py:421 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:487 +#: stock/views.py:492 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:502 +#: stock/views.py:507 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:515 +#: stock/views.py:520 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:543 +#: stock/views.py:548 msgid "No items were moved" msgstr "" -#: stock/views.py:546 +#: stock/views.py:551 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:813 +#: stock/views.py:827 msgid "Invalid part selection" msgstr "" -#: stock/views.py:875 +#: stock/views.py:889 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/locale/es/LC_MESSAGES/django.po b/InvenTree/locale/es/LC_MESSAGES/django.po index de659e0f1f..d12aa130ba 100644 --- a/InvenTree/locale/es/LC_MESSAGES/django.po +++ b/InvenTree/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-27 00:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:12+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:834 +#: build/views.py:289 stock/views.py:848 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -190,6 +190,10 @@ msgstr "" msgid "Use this currency as the base currency" msgstr "" +#: company/templates/company/partdelete.html:5 +msgid "Are you sure you want to delete the following Supplier Parts?" +msgstr "" + #: order/forms.py:21 msgid "Place order" msgstr "" @@ -223,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:437 +#: stock/models.py:438 msgid "Quantity must be greater than zero" msgstr "" @@ -247,7 +251,7 @@ msgstr "" msgid "Line item notes" msgstr "" -#: order/models.py:275 +#: order/models.py:275 stock/templates/stock/item.html:106 msgid "Purchase Order" msgstr "" @@ -409,7 +413,7 @@ msgstr "" msgid "Variant Of" msgstr "" -#: part/templates/part/detail.html:49 +#: part/templates/part/detail.html:49 stock/templates/stock/item.html:118 msgid "URL" msgstr "" @@ -497,7 +501,7 @@ msgstr "" msgid "Part cannot be sold to customers" msgstr "" -#: part/templates/part/detail.html:151 +#: part/templates/part/detail.html:151 stock/templates/stock/item.html:150 msgid "Notes" msgstr "" @@ -554,67 +558,142 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:201 +#: stock/models.py:202 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:206 +#: stock/models.py:207 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:225 +#: stock/models.py:226 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:235 stock/models.py:244 +#: stock/models.py:236 stock/models.py:245 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:236 +#: stock/models.py:237 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:252 +#: stock/models.py:253 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:261 +#: stock/models.py:262 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:434 +#: stock/models.py:361 +msgid "Stock Item Notes" +msgstr "" + +#: stock/models.py:435 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:440 +#: stock/models.py:441 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:443 stock/models.py:446 +#: stock/models.py:444 stock/models.py:447 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:449 +#: stock/models.py:450 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:459 +#: stock/models.py:460 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:480 +#: stock/models.py:481 msgid "Add serial number" msgstr "" -#: stock/models.py:483 +#: stock/models.py:484 #, python-brace-format msgid "Serialized {n} items" msgstr "" +#: stock/templates/stock/item.html:8 +msgid "Stock Item Details" +msgstr "" + +#: stock/templates/stock/item.html:51 +msgid "" +"This stock item is serialized - it has a unique serial number and the " +"quantity cannot be adjusted." +msgstr "" + +#: stock/templates/stock/item.html:55 +msgid "" +"This stock item will be automatically deleted when all stock is depleted." +msgstr "" + +#: stock/templates/stock/item.html:72 +msgid "Belongs To" +msgstr "" + +#: stock/templates/stock/item.html:77 +msgid "Location" +msgstr "" + +#: stock/templates/stock/item.html:83 +msgid "Serial Number" +msgstr "" + +#: stock/templates/stock/item.html:88 +msgid "Quantity" +msgstr "" + +#: stock/templates/stock/item.html:94 +msgid "Batch" +msgstr "" + +#: stock/templates/stock/item.html:100 +msgid "Build" +msgstr "" + +#: stock/templates/stock/item.html:112 +msgid "Customer" +msgstr "" + +#: stock/templates/stock/item.html:124 +msgid "Supplier" +msgstr "" + +#: stock/templates/stock/item.html:128 +msgid "Supplier Part" +msgstr "" + +#: stock/templates/stock/item.html:133 +msgid "Last Updated" +msgstr "" + +#: stock/templates/stock/item.html:137 +msgid "Last Stocktake" +msgstr "" + +#: stock/templates/stock/item.html:141 +msgid "No stocktake performed" +msgstr "" + +#: stock/templates/stock/item.html:145 +msgid "Status" +msgstr "" + +#: stock/templates/stock/item.html:159 +msgid "Stock Tracking Information" +msgstr "" + #: stock/templates/stock/location.html:37 msgid "Location Details" msgstr "" @@ -644,51 +723,71 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:399 +#: stock/views.py:370 +msgid "Move Stock Items" +msgstr "" + +#: stock/views.py:371 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:372 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:373 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:374 +msgid "Delete Stock Items" +msgstr "" + +#: stock/views.py:401 msgid "Must enter integer value" msgstr "" -#: stock/views.py:404 +#: stock/views.py:406 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:411 +#: stock/views.py:413 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:419 +#: stock/views.py:421 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:487 +#: stock/views.py:492 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:502 +#: stock/views.py:507 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:515 +#: stock/views.py:520 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:543 +#: stock/views.py:548 msgid "No items were moved" msgstr "" -#: stock/views.py:546 +#: stock/views.py:551 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:813 +#: stock/views.py:827 msgid "Invalid part selection" msgstr "" -#: stock/views.py:875 +#: stock/views.py:889 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 7bf6ff4e29..94bf0fd7fb 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -1,10 +1,11 @@ {% extends "stock/stock_app_base.html" %} {% load static %} +{% load i18n %} {% block content %}
    -

    Stock Item Details

    +

    {% trans "Stock Item Details" %}

    {% if item.serialized %}

    {{ item.part.full_name}} # {{ item.serial }}

    {% else %} @@ -47,11 +48,11 @@

    {% if item.serialized %}
    - This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted. + {% trans "This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted." %}
    {% elif item.delete_on_deplete %}
    - This stock item will be automatically deleted when all stock is depleted. + {% trans "This stock item will be automatically deleted when all stock is depleted." %}
    {% endif %}
    @@ -68,85 +69,85 @@ {% if item.belongs_to %} - Belongs To + {% trans "Belongs To" %} {{ item.belongs_to }} {% elif item.location %} - Location + {% trans "Location" %} {{ item.location.name }} {% endif %} {% if item.serialized %} - Serial Number + {% trans "Serial Number" %} {{ item.serial }} {% else %} - Quantity + {% trans "Quantity" %} {{ item.quantity }} {% endif %} {% if item.batch %} - Batch + {% trans "Batch" %} {{ item.batch }} {% endif %} {% if item.build %} - Build + {% trans "Build" %} {{ item.build }} {% endif %} {% if item.purchase_order %} - Purchase Order + {% trans "Purchase Order" %} {{ item.purchase_order }} {% endif %} {% if item.customer %} - Customer + {% trans "Customer" %} {{ item.customer.name }} {% endif %} {% if item.URL %} - URL + {% trans "URL" %} {{ item.URL }} {% endif %} {% if item.supplier_part %} - Supplier + {% trans "Supplier" %} {{ item.supplier_part.supplier.name }} - Supplier Part + {% trans "Supplier Part" %} {{ item.supplier_part.SKU }} {% endif %} - Last Updated + {% trans "Last Updated" %} {{ item.updated }} - Last Stocktake + {% trans "Last Stocktake" %} {% if item.stocktake_date %} {{ item.stocktake_date }} {{ item.stocktake_user }} {% else %} - No stocktake performed + {% trans "No stocktake performed" %} {% endif %} - Status + {% trans "Status" %} {{ item.get_status_display }} {% if item.notes %} - Notes + {% trans "Notes" %} {{ item.notes }} {% endif %} @@ -155,7 +156,7 @@

    -

    Stock Tracking Information

    +

    {% trans "Stock Tracking Information" %}

    From 22619733314a084432ecbbfd16392f948ac913f6 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 20:19:10 +1100 Subject: [PATCH 7/9] Ability to delete multiple stock items --- .../static/script/inventree/stock.js | 12 +++++++ InvenTree/stock/views.py | 34 +++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index 44a5aeaff4..4fffc961c7 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -310,6 +310,18 @@ function loadStockTable(table, options) { }, }); }); + + $("#multi-item-delete").click(function() { + var selections = $("#stock-table").bootstrapTable("getSelections"); + + var stock = []; + + selections.forEach(function(item) { + stock.push(item.pk); + }); + + stockAdjustment('delete'); + }); } diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index f7bbe9ad21..b618bfb7cc 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -256,6 +256,7 @@ class StockAdjust(AjaxView, FormMixin): - Add items to stock - Count items - Move stock + - Delete stock items """ @@ -361,15 +362,16 @@ class StockAdjust(AjaxView, FormMixin): self.stock_action = request.GET.get('action', '').lower() # Pick a default action... - if self.stock_action not in ['move', 'count', 'take', 'add']: + if self.stock_action not in ['move', 'count', 'take', 'add', 'delete']: self.stock_action = 'count' # Choose the form title based on the action titles = { - 'move': 'Move Stock', - 'count': 'Count Stock', - 'take': 'Remove Stock', - 'add': 'Add Stock' + 'move': _('Move Stock Items'), + 'count': _('Count Stock Items'), + 'take': _('Remove From Stock'), + 'add': _('Add Stock Items'), + 'delete': _('Delete Stock Items') } self.ajax_form_title = titles[self.stock_action] @@ -383,7 +385,7 @@ class StockAdjust(AjaxView, FormMixin): self.request = request - self.stock_action = request.POST.get('stock_action', 'invalid').lower() + self.stock_action = request.POST.get('stock_action', 'invalid').strip().lower() # Update list of stock items self.stock_items = self.get_POST_items() @@ -468,6 +470,9 @@ class StockAdjust(AjaxView, FormMixin): elif self.stock_action == 'count': return self.do_count() + elif self.stock_action == 'delete': + return self.do_delete() + else: return 'No action performed' @@ -547,6 +552,23 @@ class StockAdjust(AjaxView, FormMixin): n=count, dest=destination.pathstring)) + def do_delete(self): + """ Delete multiple stock items """ + + count = 0 + # note = self.request.POST['note'] + + for item in self.stock_items: + + # TODO - In the future, StockItems should not be 'deleted' + # TODO - Instead, they should be marked as "inactive" + + item.delete() + + count += 1 + + return _("Deleted {n} stock items".format(n=count)) + class StockItemEdit(AjaxUpdateView): """ From b7473be8efeb4cf6b1f7e08c0abd6aa15b45b016 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 20:29:05 +1100 Subject: [PATCH 8/9] Update stock adjustment dialog --- InvenTree/locale/de/LC_MESSAGES/django.po | 91 +++++++++++-------- InvenTree/locale/en/LC_MESSAGES/django.po | 91 +++++++++++-------- InvenTree/locale/es/LC_MESSAGES/django.po | 91 +++++++++++-------- .../stock/templates/stock/stock_adjust.html | 15 ++- InvenTree/stock/views.py | 5 +- 5 files changed, 170 insertions(+), 123 deletions(-) diff --git a/InvenTree/locale/de/LC_MESSAGES/django.po b/InvenTree/locale/de/LC_MESSAGES/django.po index d12aa130ba..5d59143a69 100644 --- a/InvenTree/locale/de/LC_MESSAGES/django.po +++ b/InvenTree/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-16 09:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:28+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:848 +#: build/views.py:289 stock/views.py:859 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -227,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:438 +#: stock/models.py:437 msgid "Quantity must be greater than zero" msgstr "" @@ -558,67 +558,67 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:202 +#: stock/models.py:201 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:207 +#: stock/models.py:206 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:226 +#: stock/models.py:225 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:236 stock/models.py:245 +#: stock/models.py:235 stock/models.py:244 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:237 +#: stock/models.py:236 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:253 +#: stock/models.py:252 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:262 +#: stock/models.py:261 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:361 +#: stock/models.py:360 msgid "Stock Item Notes" msgstr "" -#: stock/models.py:435 +#: stock/models.py:434 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:441 +#: stock/models.py:440 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:444 stock/models.py:447 +#: stock/models.py:443 stock/models.py:446 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:450 +#: stock/models.py:449 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:460 +#: stock/models.py:459 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:481 +#: stock/models.py:480 msgid "Add serial number" msgstr "" -#: stock/models.py:484 +#: stock/models.py:483 #, python-brace-format msgid "Serialized {n} items" msgstr "" @@ -643,6 +643,7 @@ msgid "Belongs To" msgstr "" #: stock/templates/stock/item.html:77 +#: stock/templates/stock/stock_adjust.html:16 msgid "Location" msgstr "" @@ -651,6 +652,7 @@ msgid "Serial Number" msgstr "" #: stock/templates/stock/item.html:88 +#: stock/templates/stock/stock_adjust.html:20 msgid "Quantity" msgstr "" @@ -723,71 +725,80 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:370 -msgid "Move Stock Items" -msgstr "" - -#: stock/views.py:371 -msgid "Count Stock Items" -msgstr "" - -#: stock/views.py:372 -msgid "Remove From Stock" +#: stock/templates/stock/stock_adjust.html:15 +msgid "Stock Item" msgstr "" #: stock/views.py:373 -msgid "Add Stock Items" +msgid "Move Stock Items" msgstr "" #: stock/views.py:374 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:375 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:376 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:377 msgid "Delete Stock Items" msgstr "" -#: stock/views.py:401 +#: stock/views.py:404 msgid "Must enter integer value" msgstr "" -#: stock/views.py:406 +#: stock/views.py:409 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:413 +#: stock/views.py:416 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:421 +#: stock/views.py:424 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:492 +#: stock/views.py:495 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:507 +#: stock/views.py:510 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:520 +#: stock/views.py:523 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:548 +#: stock/views.py:551 msgid "No items were moved" msgstr "" -#: stock/views.py:551 +#: stock/views.py:554 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:827 +#: stock/views.py:573 +#, python-brace-format +msgid "Deleted {n} stock items" +msgstr "" + +#: stock/views.py:838 msgid "Invalid part selection" msgstr "" -#: stock/views.py:889 +#: stock/views.py:900 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/locale/en/LC_MESSAGES/django.po b/InvenTree/locale/en/LC_MESSAGES/django.po index d12aa130ba..5d59143a69 100644 --- a/InvenTree/locale/en/LC_MESSAGES/django.po +++ b/InvenTree/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-16 09:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:28+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:848 +#: build/views.py:289 stock/views.py:859 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -227,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:438 +#: stock/models.py:437 msgid "Quantity must be greater than zero" msgstr "" @@ -558,67 +558,67 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:202 +#: stock/models.py:201 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:207 +#: stock/models.py:206 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:226 +#: stock/models.py:225 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:236 stock/models.py:245 +#: stock/models.py:235 stock/models.py:244 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:237 +#: stock/models.py:236 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:253 +#: stock/models.py:252 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:262 +#: stock/models.py:261 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:361 +#: stock/models.py:360 msgid "Stock Item Notes" msgstr "" -#: stock/models.py:435 +#: stock/models.py:434 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:441 +#: stock/models.py:440 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:444 stock/models.py:447 +#: stock/models.py:443 stock/models.py:446 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:450 +#: stock/models.py:449 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:460 +#: stock/models.py:459 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:481 +#: stock/models.py:480 msgid "Add serial number" msgstr "" -#: stock/models.py:484 +#: stock/models.py:483 #, python-brace-format msgid "Serialized {n} items" msgstr "" @@ -643,6 +643,7 @@ msgid "Belongs To" msgstr "" #: stock/templates/stock/item.html:77 +#: stock/templates/stock/stock_adjust.html:16 msgid "Location" msgstr "" @@ -651,6 +652,7 @@ msgid "Serial Number" msgstr "" #: stock/templates/stock/item.html:88 +#: stock/templates/stock/stock_adjust.html:20 msgid "Quantity" msgstr "" @@ -723,71 +725,80 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:370 -msgid "Move Stock Items" -msgstr "" - -#: stock/views.py:371 -msgid "Count Stock Items" -msgstr "" - -#: stock/views.py:372 -msgid "Remove From Stock" +#: stock/templates/stock/stock_adjust.html:15 +msgid "Stock Item" msgstr "" #: stock/views.py:373 -msgid "Add Stock Items" +msgid "Move Stock Items" msgstr "" #: stock/views.py:374 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:375 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:376 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:377 msgid "Delete Stock Items" msgstr "" -#: stock/views.py:401 +#: stock/views.py:404 msgid "Must enter integer value" msgstr "" -#: stock/views.py:406 +#: stock/views.py:409 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:413 +#: stock/views.py:416 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:421 +#: stock/views.py:424 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:492 +#: stock/views.py:495 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:507 +#: stock/views.py:510 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:520 +#: stock/views.py:523 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:548 +#: stock/views.py:551 msgid "No items were moved" msgstr "" -#: stock/views.py:551 +#: stock/views.py:554 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:827 +#: stock/views.py:573 +#, python-brace-format +msgid "Deleted {n} stock items" +msgstr "" + +#: stock/views.py:838 msgid "Invalid part selection" msgstr "" -#: stock/views.py:889 +#: stock/views.py:900 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/locale/es/LC_MESSAGES/django.po b/InvenTree/locale/es/LC_MESSAGES/django.po index d12aa130ba..5d59143a69 100644 --- a/InvenTree/locale/es/LC_MESSAGES/django.po +++ b/InvenTree/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-11-16 09:12+0000\n" +"POT-Creation-Date: 2019-11-16 09:28+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -149,7 +149,7 @@ msgstr "" msgid "Allocated quantity ({n}) must not exceed available quantity ({q})" msgstr "" -#: build/views.py:289 stock/views.py:848 +#: build/views.py:289 stock/views.py:859 #, python-brace-format msgid "The following serial numbers already exist: ({sn})" msgstr "" @@ -227,7 +227,7 @@ msgid "Company" msgstr "" #: order/models.py:156 order/models.py:201 part/views.py:1032 -#: stock/models.py:438 +#: stock/models.py:437 msgid "Quantity must be greater than zero" msgstr "" @@ -558,67 +558,67 @@ msgstr "" msgid "Set the destination as the default location for selected parts" msgstr "" -#: stock/models.py:202 +#: stock/models.py:201 #, python-brace-format msgid "" "A stock item with this serial number already exists for template part {part}" msgstr "" -#: stock/models.py:207 +#: stock/models.py:206 msgid "A stock item with this serial number already exists" msgstr "" -#: stock/models.py:226 +#: stock/models.py:225 #, python-brace-format msgid "Part type ('{pf}') must be {pe}" msgstr "" -#: stock/models.py:236 stock/models.py:245 +#: stock/models.py:235 stock/models.py:244 msgid "Quantity must be 1 for item with a serial number" msgstr "" -#: stock/models.py:237 +#: stock/models.py:236 msgid "Serial number cannot be set if quantity greater than 1" msgstr "" -#: stock/models.py:253 +#: stock/models.py:252 msgid "Stock item cannot be created for a template Part" msgstr "" -#: stock/models.py:262 +#: stock/models.py:261 msgid "Item cannot belong to itself" msgstr "" -#: stock/models.py:361 +#: stock/models.py:360 msgid "Stock Item Notes" msgstr "" -#: stock/models.py:435 +#: stock/models.py:434 msgid "Quantity must be integer" msgstr "" -#: stock/models.py:441 +#: stock/models.py:440 #, python-brace-format msgid "Quantity must not exceed available stock quantity ({n})" msgstr "" -#: stock/models.py:444 stock/models.py:447 +#: stock/models.py:443 stock/models.py:446 msgid "Serial numbers must be a list of integers" msgstr "" -#: stock/models.py:450 +#: stock/models.py:449 msgid "Quantity does not match serial numbers" msgstr "" -#: stock/models.py:460 +#: stock/models.py:459 msgid "Serial numbers already exist: " msgstr "" -#: stock/models.py:481 +#: stock/models.py:480 msgid "Add serial number" msgstr "" -#: stock/models.py:484 +#: stock/models.py:483 #, python-brace-format msgid "Serialized {n} items" msgstr "" @@ -643,6 +643,7 @@ msgid "Belongs To" msgstr "" #: stock/templates/stock/item.html:77 +#: stock/templates/stock/stock_adjust.html:16 msgid "Location" msgstr "" @@ -651,6 +652,7 @@ msgid "Serial Number" msgstr "" #: stock/templates/stock/item.html:88 +#: stock/templates/stock/stock_adjust.html:20 msgid "Quantity" msgstr "" @@ -723,71 +725,80 @@ msgstr "" msgid "Stock Locations" msgstr "" -#: stock/views.py:370 -msgid "Move Stock Items" -msgstr "" - -#: stock/views.py:371 -msgid "Count Stock Items" -msgstr "" - -#: stock/views.py:372 -msgid "Remove From Stock" +#: stock/templates/stock/stock_adjust.html:15 +msgid "Stock Item" msgstr "" #: stock/views.py:373 -msgid "Add Stock Items" +msgid "Move Stock Items" msgstr "" #: stock/views.py:374 +msgid "Count Stock Items" +msgstr "" + +#: stock/views.py:375 +msgid "Remove From Stock" +msgstr "" + +#: stock/views.py:376 +msgid "Add Stock Items" +msgstr "" + +#: stock/views.py:377 msgid "Delete Stock Items" msgstr "" -#: stock/views.py:401 +#: stock/views.py:404 msgid "Must enter integer value" msgstr "" -#: stock/views.py:406 +#: stock/views.py:409 msgid "Quantity must be positive" msgstr "" -#: stock/views.py:413 +#: stock/views.py:416 #, python-brace-format msgid "Quantity must not exceed {x}" msgstr "" -#: stock/views.py:421 +#: stock/views.py:424 msgid "Confirm stock adjustment" msgstr "" -#: stock/views.py:492 +#: stock/views.py:495 #, python-brace-format msgid "Added stock to {n} items" msgstr "" -#: stock/views.py:507 +#: stock/views.py:510 #, python-brace-format msgid "Removed stock from {n} items" msgstr "" -#: stock/views.py:520 +#: stock/views.py:523 #, python-brace-format msgid "Counted stock for {n} items" msgstr "" -#: stock/views.py:548 +#: stock/views.py:551 msgid "No items were moved" msgstr "" -#: stock/views.py:551 +#: stock/views.py:554 #, python-brace-format msgid "Moved {n} items to {dest}" msgstr "" -#: stock/views.py:827 +#: stock/views.py:573 +#, python-brace-format +msgid "Deleted {n} stock items" +msgstr "" + +#: stock/views.py:838 msgid "Invalid part selection" msgstr "" -#: stock/views.py:889 +#: stock/views.py:900 msgid "Created new stock item" msgstr "" diff --git a/InvenTree/stock/templates/stock/stock_adjust.html b/InvenTree/stock/templates/stock/stock_adjust.html index ab7bf4005e..70463d14c1 100644 --- a/InvenTree/stock/templates/stock/stock_adjust.html +++ b/InvenTree/stock/templates/stock/stock_adjust.html @@ -1,3 +1,5 @@ +{% load i18n %} + {% block pre_form_content %} {% endblock %} @@ -10,9 +12,13 @@ - - + + + {% if edit_quantity %} + {% else %} + + {% endif %} {% for item in stock_items %} @@ -21,6 +27,7 @@ {{ item.part.full_name }} {{ item.part.description }} diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index b618bfb7cc..a503efaba4 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -338,10 +338,13 @@ class StockAdjust(AjaxView, FormMixin): context['stock_items'] = self.stock_items - context['stock_action'] = self.stock_action + context['stock_action'] = self.stock_action.strip().lower() context['stock_action_title'] = self.stock_action.capitalize() + # Quantity column will be read-only in some circumstances + context['edit_quantity'] = not self.stock_action == 'delete' + return context def get_form(self): From 16f3dfb678fd7ad60a7162a5955c5b0ec9dffdbf Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 16 Nov 2019 20:39:10 +1100 Subject: [PATCH 9/9] Removed old migration file --- .../stock/migrations/0016_stockitem_active.py | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 InvenTree/stock/migrations/0016_stockitem_active.py diff --git a/InvenTree/stock/migrations/0016_stockitem_active.py b/InvenTree/stock/migrations/0016_stockitem_active.py deleted file mode 100644 index 1fb317a307..0000000000 --- a/InvenTree/stock/migrations/0016_stockitem_active.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.5 on 2019-11-16 08:40 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('stock', '0015_auto_20190913_1407'), - ] - - operations = [ - migrations.AddField( - model_name='stockitem', - name='active', - field=models.BooleanField(default=True), - ), - ]
    Stock ItemLocation{% trans "Stock Item" %}{% trans "Location" %}{{ stock_action_title }}{% trans "Quantity" %}
    {{ item.location.pathstring }} + {% if edit_quantity %} {{ item.error }} {% endif %} + {% else %} + {{ item.new_quantity }} + + {% endif %}