Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2020-05-04 09:39:19 +10:00
commit 1c3878829d
22 changed files with 1364 additions and 1232 deletions

View File

@ -1,6 +1,7 @@
from django.shortcuts import HttpResponseRedirect
from django.urls import reverse_lazy
from django.db import connection
from django.shortcuts import redirect
import logging
import time
import operator
@ -55,7 +56,7 @@ class AuthRequiredMiddleware(object):
# Does the provided token match a valid user?
if Token.objects.filter(key=token).exists():
allowed = ['/media/', '/static/']
allowed = ['/api/', '/media/', '/static/']
# Only allow token-auth for /media/ or /static/ dirs!
if any([request.path_info.startswith(a) for a in allowed]):
@ -63,9 +64,17 @@ class AuthRequiredMiddleware(object):
# No authorization was found for the request
if not authorized:
if not request.path_info == reverse_lazy('login') and not request.path_info.startswith('/api/'):
# A logout request will redirect the user to the login screen
if request.path_info == reverse_lazy('logout'):
return HttpResponseRedirect(reverse_lazy('login'))
login = reverse_lazy('login')
if not request.path_info == login and not request.path_info.startswith('/api/'):
# Save the 'next' parameter to pass through to the login view
return redirect('%s?next=%s' % (login, request.path))
# Code to be executed for each request/response after
# the view is called.

View File

@ -54,6 +54,10 @@ class StatusCode:
return codes
@classmethod
def text(cls, key):
return cls.options.get(key, None)
@classmethod
def items(cls):
return cls.options.items()
@ -150,6 +154,7 @@ class StockStatus(StatusCode):
ATTENTION = 50 # Item requires attention
DAMAGED = 55 # Item is damaged
DESTROYED = 60 # Item is destroyed
REJECTED = 65 # Item is rejected
LOST = 70 # Item has been lost
RETURNED = 85 # Item has been returned from a customer
@ -167,6 +172,7 @@ class StockStatus(StatusCode):
DAMAGED: _("Damaged"),
DESTROYED: _("Destroyed"),
LOST: _("Lost"),
REJECTED: _("Rejected"),
RETURNED: _("Returned"),
SHIPPED: _('Shipped'),
ASSIGNED_TO_BUILD: _("Used for Build"),
@ -178,6 +184,7 @@ class StockStatus(StatusCode):
ATTENTION: 'yellow',
DAMAGED: 'red',
DESTROYED: 'red',
REJECTED: 'red',
SHIPPED: 'green',
ASSIGNED_TO_BUILD: 'blue',
ASSIGNED_TO_OTHER_ITEM: 'blue',
@ -195,11 +202,21 @@ class StockStatus(StatusCode):
UNAVAILABLE_CODES = [
DESTROYED,
LOST,
REJECTED,
SHIPPED,
ASSIGNED_TO_BUILD,
ASSIGNED_TO_OTHER_ITEM,
]
# The following codes are available for receiving goods
RECEIVING_CODES = [
OK,
ATTENTION,
DAMAGED,
DESTROYED,
REJECTED
]
class BuildStatus(StatusCode):

View File

@ -35,6 +35,7 @@ from rest_framework.documentation import include_docs_urls
from .views import IndexView, SearchView, DatabaseStatsView
from .views import SettingsView, EditUserView, SetPasswordView
from .views import DynamicJsView
from .api import InfoView, BarcodePluginView, ActionPluginView
@ -74,6 +75,12 @@ settings_urls = [
]
dynamic_javascript_urls = [
url(r'^part.js', DynamicJsView.as_view(template_name='js/part.html'), name='part.js'),
url(r'^stock.js', DynamicJsView.as_view(template_name='js/stock.html'), name='stock.js'),
url(r'^build.js', DynamicJsView.as_view(template_name='js/build.html'), name='build.js'),
url(r'^order.js', DynamicJsView.as_view(template_name='js/order.html'), name='order.js'),
url(r'^company.js', DynamicJsView.as_view(template_name='js/company.html'), name='company.js'),
url(r'^bom.js', DynamicJsView.as_view(template_name='js/bom.html'), name='bom.js'),
]
urlpatterns = [
@ -95,7 +102,7 @@ urlpatterns = [
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^login/', auth_views.LoginView.as_view(), name='login'),
url(r'^login/?', auth_views.LoginView.as_view(), name='login'),
url(r'^logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'),
url(r'^settings/', include(settings_urls)),

View File

@ -514,6 +514,17 @@ class SearchView(TemplateView):
return super(TemplateView, self).render_to_response(context)
class DynamicJsView(TemplateView):
"""
View for returning javacsript files,
which instead of being served dynamically,
are passed through the django translation engine!
"""
template_name = ""
content_type = 'text/javascript'
class SettingsView(TemplateView):
""" View for configuring User settings
"""

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-02 04:54+0000\n"
"POT-Creation-Date: 2020-05-03 09:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -78,19 +78,19 @@ msgstr ""
msgid "File comment"
msgstr ""
#: InvenTree/settings.py:274
#: InvenTree/settings.py:295
msgid "English"
msgstr ""
#: InvenTree/settings.py:275
#: InvenTree/settings.py:296
msgid "German"
msgstr ""
#: InvenTree/settings.py:276
#: InvenTree/settings.py:297
msgid "French"
msgstr ""
#: InvenTree/settings.py:277
#: InvenTree/settings.py:298
msgid "Polish"
msgstr ""
@ -153,7 +153,7 @@ msgstr ""
#: InvenTree/status_codes.py:214 build/templates/build/allocate.html:349
#: order/templates/order/sales_order_detail.html:220
#: part/templates/part/part_base.html:114 part/templates/part/tabs.html:21
#: part/templates/part/tabs.html:21 templates/js/build.html:120
msgid "Allocated"
msgstr ""
@ -182,7 +182,7 @@ msgstr ""
msgid "Overage must be an integer value or a percentage"
msgstr ""
#: InvenTree/views.py:536
#: InvenTree/views.py:547
msgid "Database Statistics"
msgstr ""
@ -221,7 +221,9 @@ msgstr ""
#: order/templates/order/order_wizard/select_parts.html:30
#: order/templates/order/purchase_order_detail.html:145
#: part/templates/part/part_app_base.html:7
#: part/templates/part/set_category.html:13
#: part/templates/part/set_category.html:13 templates/js/bom.html:135
#: templates/js/build.html:41 templates/js/company.html:109
#: templates/js/part.html:111 templates/js/stock.html:206
msgid "Part"
msgstr ""
@ -255,7 +257,7 @@ msgstr ""
msgid "Number of parts to build"
msgstr ""
#: build/models.py:112 part/templates/part/part_base.html:131
#: build/models.py:112 part/templates/part/part_base.html:138
msgid "Build Status"
msgstr ""
@ -272,7 +274,7 @@ msgid "Batch code for this build output"
msgstr ""
#: build/models.py:139 build/templates/build/detail.html:55
#: company/templates/company/supplier_part_base.html:57
#: company/templates/company/supplier_part_base.html:60
#: company/templates/company/supplier_part_detail.html:24
#: part/templates/part/detail.html:67 part/templates/part/part_base.html:85
#: stock/models.py:371 stock/templates/stock/item_base.html:189
@ -288,6 +290,7 @@ msgstr ""
#: order/templates/order/purchase_order_detail.html:200
#: order/templates/order/so_tabs.html:23 part/templates/part/tabs.html:63
#: stock/models.py:439 stock/templates/stock/tabs.html:17
#: templates/js/bom.html:229 templates/js/stock.html:290
msgid "Notes"
msgstr ""
@ -371,41 +374,47 @@ msgstr ""
#: stock/templates/stock/item_base.html:20
#: stock/templates/stock/item_base.html:26
#: stock/templates/stock/item_base.html:154
#: stock/templates/stock/stock_adjust.html:18
#: stock/templates/stock/stock_adjust.html:18 templates/js/bom.html:172
#: templates/js/build.html:52 templates/js/stock.html:437
msgid "Quantity"
msgstr ""
#: build/templates/build/allocate.html:177
#: build/templates/build/auto_allocate.html:20
#: stock/templates/stock/item_base.html:134
#: stock/templates/stock/stock_adjust.html:17
#: stock/templates/stock/stock_adjust.html:17 templates/js/stock.html:277
msgid "Location"
msgstr ""
#: build/templates/build/allocate.html:201
#: order/templates/order/sales_order_detail.html:92
#: order/templates/order/sales_order_detail.html:92 templates/js/build.html:124
msgid "Edit stock allocation"
msgstr ""
#: build/templates/build/allocate.html:202
#: order/templates/order/sales_order_detail.html:93
#: order/templates/order/sales_order_detail.html:93 templates/js/build.html:125
msgid "Delete stock allocation"
msgstr ""
#: build/templates/build/allocate.html:229
#: build/templates/build/allocate.html:229 templates/js/bom.html:288
msgid "No BOM items found"
msgstr ""
#: build/templates/build/allocate.html:328
#: company/templates/company/supplier_part_base.html:50
#: company/templates/company/supplier_part_base.html:53
#: company/templates/company/supplier_part_detail.html:27
#: order/templates/order/purchase_order_detail.html:157
#: part/templates/part/detail.html:38 part/templates/part/set_category.html:14
#: templates/js/bom.html:157 templates/js/company.html:60
#: templates/js/order.html:157 templates/js/order.html:230
#: templates/js/part.html:167 templates/js/stock.html:227
#: templates/js/stock.html:418
msgid "Description"
msgstr ""
#: build/templates/build/allocate.html:333
#: order/templates/order/purchase_order_detail.html:170
#: templates/js/bom.html:164
msgid "Reference"
msgstr ""
@ -452,7 +461,8 @@ msgstr ""
#: build/templates/build/build_base.html:8
#: build/templates/build/build_base.html:34
#: build/templates/build/complete.html:6
#: stock/templates/stock/item_base.html:168 templates/navbar.html:12
#: stock/templates/stock/item_base.html:168 templates/js/build.html:33
#: templates/navbar.html:12
msgid "Build"
msgstr ""
@ -470,7 +480,9 @@ msgstr ""
#: build/templates/build/build_base.html:80
#: build/templates/build/detail.html:42
#: stock/templates/stock/item_base.html:221
#: stock/templates/stock/item_base.html:221 templates/js/build.html:57
#: templates/js/order.html:162 templates/js/order.html:235
#: templates/js/stock.html:264
msgid "Status"
msgstr ""
@ -480,7 +492,7 @@ msgstr ""
#: order/templates/order/sales_order_notes.html:10
#: order/templates/order/sales_order_ship.html:25
#: part/templates/part/allocation.html:27
#: stock/templates/stock/item_base.html:122
#: stock/templates/stock/item_base.html:122 templates/js/order.html:209
msgid "Sales Order"
msgstr ""
@ -547,13 +559,13 @@ msgid "Stock can be taken from any available location."
msgstr ""
#: build/templates/build/detail.html:48
#: stock/templates/stock/item_base.html:161
#: stock/templates/stock/item_base.html:161 templates/js/stock.html:272
msgid "Batch"
msgstr ""
#: build/templates/build/detail.html:61
#: order/templates/order/order_base.html:93
#: order/templates/order/sales_order_base.html:92
#: order/templates/order/sales_order_base.html:92 templates/js/build.html:65
msgid "Created"
msgstr ""
@ -569,7 +581,7 @@ msgstr ""
msgid "No"
msgstr ""
#: build/templates/build/detail.html:80
#: build/templates/build/detail.html:80 templates/js/build.html:70
msgid "Completed"
msgstr ""
@ -840,7 +852,7 @@ msgid "Part packaging"
msgstr ""
#: company/templates/company/company_base.html:7
#: company/templates/company/company_base.html:22
#: company/templates/company/company_base.html:22 templates/js/company.html:38
msgid "Company"
msgstr ""
@ -849,7 +861,7 @@ msgstr ""
msgid "Company Details"
msgstr ""
#: company/templates/company/company_base.html:48
#: company/templates/company/company_base.html:48 templates/js/company.html:65
msgid "Website"
msgstr ""
@ -870,22 +882,25 @@ msgid "Contact"
msgstr ""
#: company/templates/company/detail.html:16
#: company/templates/company/supplier_part_base.html:73
#: company/templates/company/supplier_part_base.html:76
#: company/templates/company/supplier_part_detail.html:30
#: templates/js/company.html:48 templates/js/company.html:158
msgid "Manufacturer"
msgstr ""
#: company/templates/company/detail.html:21
#: company/templates/company/supplier_part_base.html:63
#: company/templates/company/supplier_part_base.html:66
#: company/templates/company/supplier_part_detail.html:21 order/models.py:111
#: order/templates/order/order_base.html:74
#: order/templates/order/order_wizard/select_pos.html:30
#: stock/templates/stock/item_base.html:196
#: stock/templates/stock/item_base.html:196 templates/js/company.html:52
#: templates/js/company.html:134 templates/js/order.html:144
msgid "Supplier"
msgstr ""
#: company/templates/company/detail.html:26 order/models.py:275
#: order/templates/order/sales_order_base.html:73
#: order/templates/order/sales_order_base.html:73 templates/js/company.html:44
#: templates/js/order.html:217
msgid "Customer"
msgstr ""
@ -995,39 +1010,45 @@ msgstr ""
#: company/templates/company/supplier_part_base.html:6
#: company/templates/company/supplier_part_base.html:19 stock/models.py:344
#: stock/templates/stock/item_base.html:201
#: stock/templates/stock/item_base.html:201 templates/js/company.html:150
msgid "Supplier Part"
msgstr ""
#: company/templates/company/supplier_part_base.html:23
msgid "Edit supplier part"
#: part/templates/part/orders.html:14
msgid "Order part"
msgstr ""
#: company/templates/company/supplier_part_base.html:26
msgid "Edit supplier part"
msgstr ""
#: company/templates/company/supplier_part_base.html:29
msgid "Delete supplier part"
msgstr ""
#: company/templates/company/supplier_part_base.html:35
#: company/templates/company/supplier_part_base.html:38
#: company/templates/company/supplier_part_detail.html:11
msgid "Supplier Part Details"
msgstr ""
#: company/templates/company/supplier_part_base.html:40
#: company/templates/company/supplier_part_base.html:43
#: company/templates/company/supplier_part_detail.html:14
msgid "Internal Part"
msgstr ""
#: company/templates/company/supplier_part_base.html:67
#: company/templates/company/supplier_part_base.html:70
#: company/templates/company/supplier_part_detail.html:22
msgid "SKU"
msgstr ""
#: company/templates/company/supplier_part_base.html:77
#: company/templates/company/supplier_part_base.html:80
#: company/templates/company/supplier_part_detail.html:31
#: templates/js/company.html:174
msgid "MPN"
msgstr ""
#: company/templates/company/supplier_part_base.html:84
#: company/templates/company/supplier_part_base.html:87
#: company/templates/company/supplier_part_detail.html:34
msgid "Note"
msgstr ""
@ -1057,6 +1078,7 @@ msgid "New Price Break"
msgstr ""
#: company/templates/company/supplier_part_pricing.html:28
#: templates/js/bom.html:213
msgid "Price"
msgstr ""
@ -1086,7 +1108,8 @@ msgstr ""
#: company/templates/company/supplier_part_tabs.html:8
#: company/templates/company/tabs.html:12 part/templates/part/tabs.html:17
#: stock/templates/stock/location.html:12 templates/navbar.html:11
#: stock/templates/stock/location.html:12 templates/js/part.html:194
#: templates/js/stock.html:235 templates/navbar.html:11
msgid "Stock"
msgstr ""
@ -1260,7 +1283,7 @@ msgstr ""
#: order/models.py:427 order/templates/order/order_base.html:9
#: order/templates/order/order_base.html:23
#: stock/templates/stock/item_base.html:175
#: stock/templates/stock/item_base.html:175 templates/js/order.html:136
msgid "Purchase Order"
msgstr ""
@ -1315,7 +1338,7 @@ msgstr ""
msgid "Order Status"
msgstr ""
#: order/templates/order/order_base.html:80
#: order/templates/order/order_base.html:80 templates/js/order.html:151
msgid "Supplier Reference"
msgstr ""
@ -1370,7 +1393,8 @@ msgid "Select existing purchase orders, or create new orders."
msgstr ""
#: order/templates/order/order_wizard/select_pos.html:31
#: order/templates/order/po_tabs.html:5
#: order/templates/order/po_tabs.html:5 templates/js/order.html:175
#: templates/js/order.html:253
msgid "Items"
msgstr ""
@ -1422,8 +1446,8 @@ msgid "Attachments"
msgstr ""
#: order/templates/order/purchase_order_detail.html:16
#: order/templates/order/sales_order_detail.html:17 order/views.py:1042
#: order/views.py:1156
#: order/templates/order/sales_order_detail.html:17 order/views.py:1051
#: order/views.py:1165
msgid "Add Line Item"
msgstr ""
@ -1474,7 +1498,7 @@ msgstr ""
msgid "Sales Order Details"
msgstr ""
#: order/templates/order/sales_order_base.html:79
#: order/templates/order/sales_order_base.html:79 templates/js/order.html:224
msgid "Customer Reference"
msgstr ""
@ -1645,39 +1669,39 @@ msgstr ""
msgid "No lines specified"
msgstr ""
#: order/views.py:1062
#: order/views.py:1071
msgid "Invalid Purchase Order"
msgstr ""
#: order/views.py:1070
#: order/views.py:1079
msgid "Supplier must match for Part and Order"
msgstr ""
#: order/views.py:1075
#: order/views.py:1084
msgid "Invalid SupplierPart selection"
msgstr ""
#: order/views.py:1207 order/views.py:1225
#: order/views.py:1216 order/views.py:1234
msgid "Edit Line Item"
msgstr ""
#: order/views.py:1241 order/views.py:1253
#: order/views.py:1250 order/views.py:1262
msgid "Delete Line Item"
msgstr ""
#: order/views.py:1246 order/views.py:1258
#: order/views.py:1255 order/views.py:1267
msgid "Deleted line item"
msgstr ""
#: order/views.py:1267
#: order/views.py:1276
msgid "Allocate Stock to Order"
msgstr ""
#: order/views.py:1336
#: order/views.py:1345
msgid "Edit Allocation Quantity"
msgstr ""
#: order/views.py:1351
#: order/views.py:1360
msgid "Remove allocation"
msgstr ""
@ -1923,7 +1947,8 @@ msgstr ""
#: stock/templates/stock/item_base.html:8
#: stock/templates/stock/item_base.html:52
#: stock/templates/stock/item_base.html:183
#: stock/templates/stock/stock_adjust.html:16
#: stock/templates/stock/stock_adjust.html:16 templates/js/build.html:106
#: templates/js/stock.html:407
msgid "Stock Item"
msgstr ""
@ -2022,6 +2047,7 @@ msgid "Variant Of"
msgstr ""
#: part/templates/part/detail.html:57 part/templates/part/set_category.html:15
#: templates/js/part.html:181
msgid "Category"
msgstr ""
@ -2037,7 +2063,7 @@ msgstr ""
msgid "Minimum Stock"
msgstr ""
#: part/templates/part/detail.html:101
#: part/templates/part/detail.html:101 templates/js/order.html:243
msgid "Creation Date"
msgstr ""
@ -2121,10 +2147,6 @@ msgstr ""
msgid "Part Notes"
msgstr ""
#: part/templates/part/orders.html:14
msgid "Order part"
msgstr ""
#: part/templates/part/orders.html:14
msgid "Order Part"
msgstr ""
@ -2177,7 +2199,8 @@ msgstr ""
msgid "This part is a variant of"
msgstr ""
#: part/templates/part/part_base.html:30
#: part/templates/part/part_base.html:30 templates/js/company.html:125
#: templates/js/part.html:158
msgid "Inactive"
msgstr ""
@ -2197,15 +2220,23 @@ msgstr ""
msgid "In Stock"
msgstr ""
#: part/templates/part/part_base.html:114
msgid "Allocated to Build Orders"
msgstr ""
#: part/templates/part/part_base.html:121
msgid "Allocated to Sales Orders"
msgstr ""
#: part/templates/part/part_base.html:128 templates/js/part.html:210
msgid "On Order"
msgstr ""
#: part/templates/part/part_base.html:136
#: part/templates/part/part_base.html:143
msgid "Can Build"
msgstr ""
#: part/templates/part/part_base.html:142
#: part/templates/part/part_base.html:149
msgid "Underway"
msgstr ""
@ -2241,7 +2272,8 @@ msgstr ""
msgid "Create New Part"
msgstr ""
#: part/templates/part/stock_count.html:7
#: part/templates/part/stock_count.html:7 templates/js/bom.html:203
#: templates/js/part.html:218
msgid "No Stock"
msgstr ""
@ -2949,6 +2981,130 @@ msgstr ""
msgid "Submit Bug Report"
msgstr ""
#: templates/js/bom.html:143
msgid "Open subassembly"
msgstr ""
#: templates/js/bom.html:194 templates/js/build.html:113
msgid "Available"
msgstr ""
#: templates/js/bom.html:219
msgid "No pricing available"
msgstr ""
#: templates/js/bom.html:239
msgid "Validate BOM Item"
msgstr ""
#: templates/js/bom.html:240
msgid "This line has been validated"
msgstr ""
#: templates/js/bom.html:242
msgid "Edit BOM Item"
msgstr ""
#: templates/js/bom.html:243
msgid "Delete BOM Item"
msgstr ""
#: templates/js/build.html:19
msgid "No builds matching query"
msgstr ""
#: templates/js/build.html:102
msgid "No parts allocated for"
msgstr ""
#: templates/js/company.html:29
msgid "No company information found"
msgstr ""
#: templates/js/company.html:101
msgid "No supplier parts found"
msgstr ""
#: templates/js/company.html:117 templates/js/part.html:136
msgid "Template part"
msgstr ""
#: templates/js/company.html:121 templates/js/part.html:140
msgid "Assembled part"
msgstr ""
#: templates/js/company.html:178
msgid "Link"
msgstr ""
#: templates/js/order.html:126
msgid "No purchase orders found"
msgstr ""
#: templates/js/order.html:170 templates/js/stock.html:389
msgid "Date"
msgstr ""
#: templates/js/order.html:199
msgid "No sales orders found"
msgstr ""
#: templates/js/order.html:248
msgid "Shipment Date"
msgstr ""
#: templates/js/part.html:104 templates/js/stock.html:196
msgid "Select"
msgstr ""
#: templates/js/part.html:144
msgid "Starred part"
msgstr ""
#: templates/js/part.html:148
msgid "Salable part"
msgstr ""
#: templates/js/part.html:187
msgid "No category"
msgstr ""
#: templates/js/part.html:205 templates/table_filters.html:95
msgid "Low stock"
msgstr ""
#: templates/js/part.html:214
msgid "Building"
msgstr ""
#: templates/js/part.html:232
msgid "No parts found"
msgstr ""
#: templates/js/stock.html:66
msgid "No stock items matching query"
msgstr ""
#: templates/js/stock.html:251
msgid "StockItem has been allocated"
msgstr ""
#: templates/js/stock.html:256
msgid "StockItem is lost"
msgstr ""
#: templates/js/stock.html:284
msgid "No stock location set"
msgstr ""
#: templates/js/stock.html:446
msgid "User"
msgstr ""
#: templates/js/stock.html:455
msgid "No user information"
msgstr ""
#: templates/navbar.html:14
msgid "Buy"
msgstr ""
@ -3069,10 +3225,6 @@ msgstr ""
msgid "Stock available"
msgstr ""
#: templates/table_filters.html:95
msgid "Low stock"
msgstr ""
#: templates/table_filters.html:107
msgid "Starred"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-02 04:54+0000\n"
"POT-Creation-Date: 2020-05-03 09:34+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -78,19 +78,19 @@ msgstr ""
msgid "File comment"
msgstr ""
#: InvenTree/settings.py:274
#: InvenTree/settings.py:295
msgid "English"
msgstr ""
#: InvenTree/settings.py:275
#: InvenTree/settings.py:296
msgid "German"
msgstr ""
#: InvenTree/settings.py:276
#: InvenTree/settings.py:297
msgid "French"
msgstr ""
#: InvenTree/settings.py:277
#: InvenTree/settings.py:298
msgid "Polish"
msgstr ""
@ -153,7 +153,7 @@ msgstr ""
#: InvenTree/status_codes.py:214 build/templates/build/allocate.html:349
#: order/templates/order/sales_order_detail.html:220
#: part/templates/part/part_base.html:114 part/templates/part/tabs.html:21
#: part/templates/part/tabs.html:21 templates/js/build.html:120
msgid "Allocated"
msgstr ""
@ -182,7 +182,7 @@ msgstr ""
msgid "Overage must be an integer value or a percentage"
msgstr ""
#: InvenTree/views.py:536
#: InvenTree/views.py:547
msgid "Database Statistics"
msgstr ""
@ -221,7 +221,9 @@ msgstr ""
#: order/templates/order/order_wizard/select_parts.html:30
#: order/templates/order/purchase_order_detail.html:145
#: part/templates/part/part_app_base.html:7
#: part/templates/part/set_category.html:13
#: part/templates/part/set_category.html:13 templates/js/bom.html:135
#: templates/js/build.html:41 templates/js/company.html:109
#: templates/js/part.html:111 templates/js/stock.html:206
msgid "Part"
msgstr ""
@ -255,7 +257,7 @@ msgstr ""
msgid "Number of parts to build"
msgstr ""
#: build/models.py:112 part/templates/part/part_base.html:131
#: build/models.py:112 part/templates/part/part_base.html:138
msgid "Build Status"
msgstr ""
@ -272,7 +274,7 @@ msgid "Batch code for this build output"
msgstr ""
#: build/models.py:139 build/templates/build/detail.html:55
#: company/templates/company/supplier_part_base.html:57
#: company/templates/company/supplier_part_base.html:60
#: company/templates/company/supplier_part_detail.html:24
#: part/templates/part/detail.html:67 part/templates/part/part_base.html:85
#: stock/models.py:371 stock/templates/stock/item_base.html:189
@ -288,6 +290,7 @@ msgstr ""
#: order/templates/order/purchase_order_detail.html:200
#: order/templates/order/so_tabs.html:23 part/templates/part/tabs.html:63
#: stock/models.py:439 stock/templates/stock/tabs.html:17
#: templates/js/bom.html:229 templates/js/stock.html:290
msgid "Notes"
msgstr ""
@ -371,41 +374,47 @@ msgstr ""
#: stock/templates/stock/item_base.html:20
#: stock/templates/stock/item_base.html:26
#: stock/templates/stock/item_base.html:154
#: stock/templates/stock/stock_adjust.html:18
#: stock/templates/stock/stock_adjust.html:18 templates/js/bom.html:172
#: templates/js/build.html:52 templates/js/stock.html:437
msgid "Quantity"
msgstr ""
#: build/templates/build/allocate.html:177
#: build/templates/build/auto_allocate.html:20
#: stock/templates/stock/item_base.html:134
#: stock/templates/stock/stock_adjust.html:17
#: stock/templates/stock/stock_adjust.html:17 templates/js/stock.html:277
msgid "Location"
msgstr ""
#: build/templates/build/allocate.html:201
#: order/templates/order/sales_order_detail.html:92
#: order/templates/order/sales_order_detail.html:92 templates/js/build.html:124
msgid "Edit stock allocation"
msgstr ""
#: build/templates/build/allocate.html:202
#: order/templates/order/sales_order_detail.html:93
#: order/templates/order/sales_order_detail.html:93 templates/js/build.html:125
msgid "Delete stock allocation"
msgstr ""
#: build/templates/build/allocate.html:229
#: build/templates/build/allocate.html:229 templates/js/bom.html:288
msgid "No BOM items found"
msgstr ""
#: build/templates/build/allocate.html:328
#: company/templates/company/supplier_part_base.html:50
#: company/templates/company/supplier_part_base.html:53
#: company/templates/company/supplier_part_detail.html:27
#: order/templates/order/purchase_order_detail.html:157
#: part/templates/part/detail.html:38 part/templates/part/set_category.html:14
#: templates/js/bom.html:157 templates/js/company.html:60
#: templates/js/order.html:157 templates/js/order.html:230
#: templates/js/part.html:167 templates/js/stock.html:227
#: templates/js/stock.html:418
msgid "Description"
msgstr ""
#: build/templates/build/allocate.html:333
#: order/templates/order/purchase_order_detail.html:170
#: templates/js/bom.html:164
msgid "Reference"
msgstr ""
@ -452,7 +461,8 @@ msgstr ""
#: build/templates/build/build_base.html:8
#: build/templates/build/build_base.html:34
#: build/templates/build/complete.html:6
#: stock/templates/stock/item_base.html:168 templates/navbar.html:12
#: stock/templates/stock/item_base.html:168 templates/js/build.html:33
#: templates/navbar.html:12
msgid "Build"
msgstr ""
@ -470,7 +480,9 @@ msgstr ""
#: build/templates/build/build_base.html:80
#: build/templates/build/detail.html:42
#: stock/templates/stock/item_base.html:221
#: stock/templates/stock/item_base.html:221 templates/js/build.html:57
#: templates/js/order.html:162 templates/js/order.html:235
#: templates/js/stock.html:264
msgid "Status"
msgstr ""
@ -480,7 +492,7 @@ msgstr ""
#: order/templates/order/sales_order_notes.html:10
#: order/templates/order/sales_order_ship.html:25
#: part/templates/part/allocation.html:27
#: stock/templates/stock/item_base.html:122
#: stock/templates/stock/item_base.html:122 templates/js/order.html:209
msgid "Sales Order"
msgstr ""
@ -547,13 +559,13 @@ msgid "Stock can be taken from any available location."
msgstr ""
#: build/templates/build/detail.html:48
#: stock/templates/stock/item_base.html:161
#: stock/templates/stock/item_base.html:161 templates/js/stock.html:272
msgid "Batch"
msgstr ""
#: build/templates/build/detail.html:61
#: order/templates/order/order_base.html:93
#: order/templates/order/sales_order_base.html:92
#: order/templates/order/sales_order_base.html:92 templates/js/build.html:65
msgid "Created"
msgstr ""
@ -569,7 +581,7 @@ msgstr ""
msgid "No"
msgstr ""
#: build/templates/build/detail.html:80
#: build/templates/build/detail.html:80 templates/js/build.html:70
msgid "Completed"
msgstr ""
@ -840,7 +852,7 @@ msgid "Part packaging"
msgstr ""
#: company/templates/company/company_base.html:7
#: company/templates/company/company_base.html:22
#: company/templates/company/company_base.html:22 templates/js/company.html:38
msgid "Company"
msgstr ""
@ -849,7 +861,7 @@ msgstr ""
msgid "Company Details"
msgstr ""
#: company/templates/company/company_base.html:48
#: company/templates/company/company_base.html:48 templates/js/company.html:65
msgid "Website"
msgstr ""
@ -870,22 +882,25 @@ msgid "Contact"
msgstr ""
#: company/templates/company/detail.html:16
#: company/templates/company/supplier_part_base.html:73
#: company/templates/company/supplier_part_base.html:76
#: company/templates/company/supplier_part_detail.html:30
#: templates/js/company.html:48 templates/js/company.html:158
msgid "Manufacturer"
msgstr ""
#: company/templates/company/detail.html:21
#: company/templates/company/supplier_part_base.html:63
#: company/templates/company/supplier_part_base.html:66
#: company/templates/company/supplier_part_detail.html:21 order/models.py:111
#: order/templates/order/order_base.html:74
#: order/templates/order/order_wizard/select_pos.html:30
#: stock/templates/stock/item_base.html:196
#: stock/templates/stock/item_base.html:196 templates/js/company.html:52
#: templates/js/company.html:134 templates/js/order.html:144
msgid "Supplier"
msgstr ""
#: company/templates/company/detail.html:26 order/models.py:275
#: order/templates/order/sales_order_base.html:73
#: order/templates/order/sales_order_base.html:73 templates/js/company.html:44
#: templates/js/order.html:217
msgid "Customer"
msgstr ""
@ -995,39 +1010,45 @@ msgstr ""
#: company/templates/company/supplier_part_base.html:6
#: company/templates/company/supplier_part_base.html:19 stock/models.py:344
#: stock/templates/stock/item_base.html:201
#: stock/templates/stock/item_base.html:201 templates/js/company.html:150
msgid "Supplier Part"
msgstr ""
#: company/templates/company/supplier_part_base.html:23
msgid "Edit supplier part"
#: part/templates/part/orders.html:14
msgid "Order part"
msgstr ""
#: company/templates/company/supplier_part_base.html:26
msgid "Edit supplier part"
msgstr ""
#: company/templates/company/supplier_part_base.html:29
msgid "Delete supplier part"
msgstr ""
#: company/templates/company/supplier_part_base.html:35
#: company/templates/company/supplier_part_base.html:38
#: company/templates/company/supplier_part_detail.html:11
msgid "Supplier Part Details"
msgstr ""
#: company/templates/company/supplier_part_base.html:40
#: company/templates/company/supplier_part_base.html:43
#: company/templates/company/supplier_part_detail.html:14
msgid "Internal Part"
msgstr ""
#: company/templates/company/supplier_part_base.html:67
#: company/templates/company/supplier_part_base.html:70
#: company/templates/company/supplier_part_detail.html:22
msgid "SKU"
msgstr ""
#: company/templates/company/supplier_part_base.html:77
#: company/templates/company/supplier_part_base.html:80
#: company/templates/company/supplier_part_detail.html:31
#: templates/js/company.html:174
msgid "MPN"
msgstr ""
#: company/templates/company/supplier_part_base.html:84
#: company/templates/company/supplier_part_base.html:87
#: company/templates/company/supplier_part_detail.html:34
msgid "Note"
msgstr ""
@ -1057,6 +1078,7 @@ msgid "New Price Break"
msgstr ""
#: company/templates/company/supplier_part_pricing.html:28
#: templates/js/bom.html:213
msgid "Price"
msgstr ""
@ -1086,7 +1108,8 @@ msgstr ""
#: company/templates/company/supplier_part_tabs.html:8
#: company/templates/company/tabs.html:12 part/templates/part/tabs.html:17
#: stock/templates/stock/location.html:12 templates/navbar.html:11
#: stock/templates/stock/location.html:12 templates/js/part.html:194
#: templates/js/stock.html:235 templates/navbar.html:11
msgid "Stock"
msgstr ""
@ -1260,7 +1283,7 @@ msgstr ""
#: order/models.py:427 order/templates/order/order_base.html:9
#: order/templates/order/order_base.html:23
#: stock/templates/stock/item_base.html:175
#: stock/templates/stock/item_base.html:175 templates/js/order.html:136
msgid "Purchase Order"
msgstr ""
@ -1315,7 +1338,7 @@ msgstr ""
msgid "Order Status"
msgstr ""
#: order/templates/order/order_base.html:80
#: order/templates/order/order_base.html:80 templates/js/order.html:151
msgid "Supplier Reference"
msgstr ""
@ -1370,7 +1393,8 @@ msgid "Select existing purchase orders, or create new orders."
msgstr ""
#: order/templates/order/order_wizard/select_pos.html:31
#: order/templates/order/po_tabs.html:5
#: order/templates/order/po_tabs.html:5 templates/js/order.html:175
#: templates/js/order.html:253
msgid "Items"
msgstr ""
@ -1422,8 +1446,8 @@ msgid "Attachments"
msgstr ""
#: order/templates/order/purchase_order_detail.html:16
#: order/templates/order/sales_order_detail.html:17 order/views.py:1042
#: order/views.py:1156
#: order/templates/order/sales_order_detail.html:17 order/views.py:1051
#: order/views.py:1165
msgid "Add Line Item"
msgstr ""
@ -1474,7 +1498,7 @@ msgstr ""
msgid "Sales Order Details"
msgstr ""
#: order/templates/order/sales_order_base.html:79
#: order/templates/order/sales_order_base.html:79 templates/js/order.html:224
msgid "Customer Reference"
msgstr ""
@ -1645,39 +1669,39 @@ msgstr ""
msgid "No lines specified"
msgstr ""
#: order/views.py:1062
#: order/views.py:1071
msgid "Invalid Purchase Order"
msgstr ""
#: order/views.py:1070
#: order/views.py:1079
msgid "Supplier must match for Part and Order"
msgstr ""
#: order/views.py:1075
#: order/views.py:1084
msgid "Invalid SupplierPart selection"
msgstr ""
#: order/views.py:1207 order/views.py:1225
#: order/views.py:1216 order/views.py:1234
msgid "Edit Line Item"
msgstr ""
#: order/views.py:1241 order/views.py:1253
#: order/views.py:1250 order/views.py:1262
msgid "Delete Line Item"
msgstr ""
#: order/views.py:1246 order/views.py:1258
#: order/views.py:1255 order/views.py:1267
msgid "Deleted line item"
msgstr ""
#: order/views.py:1267
#: order/views.py:1276
msgid "Allocate Stock to Order"
msgstr ""
#: order/views.py:1336
#: order/views.py:1345
msgid "Edit Allocation Quantity"
msgstr ""
#: order/views.py:1351
#: order/views.py:1360
msgid "Remove allocation"
msgstr ""
@ -1923,7 +1947,8 @@ msgstr ""
#: stock/templates/stock/item_base.html:8
#: stock/templates/stock/item_base.html:52
#: stock/templates/stock/item_base.html:183
#: stock/templates/stock/stock_adjust.html:16
#: stock/templates/stock/stock_adjust.html:16 templates/js/build.html:106
#: templates/js/stock.html:407
msgid "Stock Item"
msgstr ""
@ -2022,6 +2047,7 @@ msgid "Variant Of"
msgstr ""
#: part/templates/part/detail.html:57 part/templates/part/set_category.html:15
#: templates/js/part.html:181
msgid "Category"
msgstr ""
@ -2037,7 +2063,7 @@ msgstr ""
msgid "Minimum Stock"
msgstr ""
#: part/templates/part/detail.html:101
#: part/templates/part/detail.html:101 templates/js/order.html:243
msgid "Creation Date"
msgstr ""
@ -2121,10 +2147,6 @@ msgstr ""
msgid "Part Notes"
msgstr ""
#: part/templates/part/orders.html:14
msgid "Order part"
msgstr ""
#: part/templates/part/orders.html:14
msgid "Order Part"
msgstr ""
@ -2177,7 +2199,8 @@ msgstr ""
msgid "This part is a variant of"
msgstr ""
#: part/templates/part/part_base.html:30
#: part/templates/part/part_base.html:30 templates/js/company.html:125
#: templates/js/part.html:158
msgid "Inactive"
msgstr ""
@ -2197,15 +2220,23 @@ msgstr ""
msgid "In Stock"
msgstr ""
#: part/templates/part/part_base.html:114
msgid "Allocated to Build Orders"
msgstr ""
#: part/templates/part/part_base.html:121
msgid "Allocated to Sales Orders"
msgstr ""
#: part/templates/part/part_base.html:128 templates/js/part.html:210
msgid "On Order"
msgstr ""
#: part/templates/part/part_base.html:136
#: part/templates/part/part_base.html:143
msgid "Can Build"
msgstr ""
#: part/templates/part/part_base.html:142
#: part/templates/part/part_base.html:149
msgid "Underway"
msgstr ""
@ -2241,7 +2272,8 @@ msgstr ""
msgid "Create New Part"
msgstr ""
#: part/templates/part/stock_count.html:7
#: part/templates/part/stock_count.html:7 templates/js/bom.html:203
#: templates/js/part.html:218
msgid "No Stock"
msgstr ""
@ -2949,6 +2981,130 @@ msgstr ""
msgid "Submit Bug Report"
msgstr ""
#: templates/js/bom.html:143
msgid "Open subassembly"
msgstr ""
#: templates/js/bom.html:194 templates/js/build.html:113
msgid "Available"
msgstr ""
#: templates/js/bom.html:219
msgid "No pricing available"
msgstr ""
#: templates/js/bom.html:239
msgid "Validate BOM Item"
msgstr ""
#: templates/js/bom.html:240
msgid "This line has been validated"
msgstr ""
#: templates/js/bom.html:242
msgid "Edit BOM Item"
msgstr ""
#: templates/js/bom.html:243
msgid "Delete BOM Item"
msgstr ""
#: templates/js/build.html:19
msgid "No builds matching query"
msgstr ""
#: templates/js/build.html:102
msgid "No parts allocated for"
msgstr ""
#: templates/js/company.html:29
msgid "No company information found"
msgstr ""
#: templates/js/company.html:101
msgid "No supplier parts found"
msgstr ""
#: templates/js/company.html:117 templates/js/part.html:136
msgid "Template part"
msgstr ""
#: templates/js/company.html:121 templates/js/part.html:140
msgid "Assembled part"
msgstr ""
#: templates/js/company.html:178
msgid "Link"
msgstr ""
#: templates/js/order.html:126
msgid "No purchase orders found"
msgstr ""
#: templates/js/order.html:170 templates/js/stock.html:389
msgid "Date"
msgstr ""
#: templates/js/order.html:199
msgid "No sales orders found"
msgstr ""
#: templates/js/order.html:248
msgid "Shipment Date"
msgstr ""
#: templates/js/part.html:104 templates/js/stock.html:196
msgid "Select"
msgstr ""
#: templates/js/part.html:144
msgid "Starred part"
msgstr ""
#: templates/js/part.html:148
msgid "Salable part"
msgstr ""
#: templates/js/part.html:187
msgid "No category"
msgstr ""
#: templates/js/part.html:205 templates/table_filters.html:95
msgid "Low stock"
msgstr ""
#: templates/js/part.html:214
msgid "Building"
msgstr ""
#: templates/js/part.html:232
msgid "No parts found"
msgstr ""
#: templates/js/stock.html:66
msgid "No stock items matching query"
msgstr ""
#: templates/js/stock.html:251
msgid "StockItem has been allocated"
msgstr ""
#: templates/js/stock.html:256
msgid "StockItem is lost"
msgstr ""
#: templates/js/stock.html:284
msgid "No stock location set"
msgstr ""
#: templates/js/stock.html:446
msgid "User"
msgstr ""
#: templates/js/stock.html:455
msgid "No user information"
msgstr ""
#: templates/navbar.html:14
msgid "Buy"
msgstr ""
@ -3069,10 +3225,6 @@ msgstr ""
msgid "Stock available"
msgstr ""
#: templates/table_filters.html:95
msgid "Low stock"
msgstr ""
#: templates/table_filters.html:107
msgid "Starred"
msgstr ""

View File

@ -209,7 +209,7 @@ class PurchaseOrder(Order):
return self.pending_line_items().count() == 0
@transaction.atomic
def receive_line_item(self, line, location, quantity, user):
def receive_line_item(self, line, location, quantity, user, status=StockStatus.OK):
""" Receive a line item (or partial line item) against this PO
"""
@ -230,7 +230,9 @@ class PurchaseOrder(Order):
supplier_part=line.part,
location=location,
quantity=quantity,
purchase_order=self)
purchase_order=self,
status=status
)
stock.save()

View File

@ -145,7 +145,7 @@ $("#po-table").inventreeTable({
title: '{% trans "Part" %}',
formatter: function(value, row, index, field) {
if (row.part) {
return imageHoverIcon(row.part_detail.thumbnail) + renderLink(row.part_detail.full_name, `/part/${value}/`);
return imageHoverIcon(row.part_detail.thumbnail) + renderLink(row.part_detail.full_name, `/part/${row.part_detail.pk}/`);
} else {
return '-';
}

View File

@ -1,23 +1,28 @@
{% extends "modal_form.html" %}
{% load i18n %}
{% load inventree_extras %}
{% load status_codes %}
{% block form %}
Receive outstanding parts for <b>{{ order }}</b> - <i>{{ order.description }}</i>
{% trans "Receive outstanding parts for" %} <b>{{ order }}</b> - <i>{{ order.description }}</i>
<form method='post' action='' class='js-modal-form' enctype='multipart/form-data'>
{% csrf_token %}
{% load crispy_forms_tags %}
<label class='control-label'>Parts</label>
<p class='help-block'>Select parts to receive against this order.</p>
<label class='control-label'>{% trans "Parts" %}</label>
<p class='help-block'>{% trans "Select parts to receive against this order" %}</p>
<table class='table table-striped'>
<tr>
<th>Part</th>
<th>Order Code</th>
<th>On Order</th>
<th>Received</th>
<th>Receive</th>
<th>{% trans "Part" %}</th>
<th>{% trans "Order Code" %}</th>
<th>{% trans "On Order" %}</th>
<th>{% trans "Received" %}</th>
<th>{% trans "Receive" %}</th>
<th>{% trans "Status" %}</th>
<th></th>
</tr>
{% for line in lines %}
<tr id='line_row_{{ line.id }}'>
@ -28,20 +33,29 @@ Receive outstanding parts for <b>{{ order }}</b> - <i>{{ order.description }}</i
</td>
<td>{{ line.part.SKU }}</td>
{% else %}
<td colspan='2'>Referenced part has been removed</td>
<td colspan='2'>{% trans "Error: Referenced part has been removed" %}</td>
{% endif %}
<td>{{ line.quantity }}</td>
<td>{{ line.received }}</td>
<td>{% decimal line.quantity %}</td>
<td>{% decimal line.received %}</td>
<td>
<div class='control-group'>
<div class='controls'>
<input class='numberinput' type='number' min='0' value='{{ line.receive_quantity }}' name='line-{{ line.id }}'/>
<input class='numberinput' type='number' min='0' value='{% decimal line.receive_quantity %}' name='line-{{ line.id }}'/>
</div>
</div>
</td>
<td>
<div class='control-group'>
<select class='select' name='status-{{ line.id }}'>
{% for code in StockStatus.RECEIVING_CODES %}
<option value="{{ code }}" {% if code|add:"0" == line.status_code|add:"0" %}selected="selected"{% endif %}>{% stock_status_text code %}</option>
{% endfor %}
</select>
</div>
</td>
<td>
<button class='btn btn-default btn-remove' onClick="removeOrderRowFromOrderWizard()" id='del_item_{{ line.id }}' title='Remove line' type='button'>
<span row='line_row_{{ line.id }}' class='fas fa-trash-alt icon-red'></span>
<span row='line_row_{{ line.id }}' class='fas fa-times-circle icon-red'></span>
</button>
</td>
</tr>

View File

@ -29,7 +29,7 @@ from . import forms as order_forms
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
from InvenTree.helpers import DownloadFile, str2bool
from InvenTree.status_codes import PurchaseOrderStatus
from InvenTree.status_codes import PurchaseOrderStatus, StockStatus
logger = logging.getLogger(__name__)
@ -669,6 +669,20 @@ class PurchaseOrderReceive(AjaxUpdateView):
except (PurchaseOrderLineItem.DoesNotExist, ValueError):
continue
# Check that the StockStatus was set
status_key = 'status-{pk}'.format(pk=pk)
status = request.POST.get(status_key, StockStatus.OK)
try:
status = int(status)
except ValueError:
status = StockStatus.OK
if status in StockStatus.RECEIVING_CODES:
line.status_code = status
else:
line.status_code = StockStatus.OK
# Check that line matches the order
if not line.order == self.order:
# TODO - Display a non-field error?
@ -725,7 +739,13 @@ class PurchaseOrderReceive(AjaxUpdateView):
if not line.part:
continue
self.order.receive_line_item(line, self.destination, line.receive_quantity, self.request.user)
self.order.receive_line_item(
line,
self.destination,
line.receive_quantity,
self.request.user,
status=line.status_code,
)
class OrderParts(AjaxView):

View File

@ -28,6 +28,11 @@ def stock_status_label(key, *args, **kwargs):
return mark_safe(StockStatus.render(key, large=kwargs.get('large', False)))
@register.simple_tag
def stock_status_text(key, *args, **kwargs):
return mark_safe(StockStatus.text(key))
@register.simple_tag
def build_status_label(key, *args, **kwargs):
""" Render a Build status label """

View File

@ -0,0 +1,111 @@
"""
This script is used to simplify the translation process.
Django provides a framework for working out which strings are "translatable",
and these strings are then dumped in a file under InvenTree/locale/<lang>/LC_MESSAGES/django.po
This script presents the translator with a list of strings which have not yet been translated,
allowing for a simpler and quicker translation process.
If a string translation needs to be updated, this will still need to be done manually,
by editing the appropriate .po file.
"""
import argparse
import os
import sys
def manually_translate_file(filename, save=False):
"""
Manually translate a .po file.
Present any missing translation strings to the translator,
and write their responses back to the file.
"""
print("Add manual translations to '{f}'".format(f=filename))
print("For each missing translation:")
print("a) Directly enter a new tranlation in the target language")
print("b) Leave empty to skip")
input("Press <ENTER> to continue")
print("")
with open(filename, 'r') as f:
lines = f.readlines()
out = []
# Context data
source_line = ''
msgid = ''
for num, line in enumerate(lines):
# Keep track of context data BEFORE an empty msgstr object
line = line.strip()
if line.startswith("#: "):
source_line = line.replace("#: ", "")
elif line.startswith("msgid "):
msgid = line.replace("msgid ", "")
if line.strip() == 'msgstr ""':
# We have found an empty translation!
if msgid and len(msgid) > 0 and not msgid == '""':
print("Source:", source_line)
print("Enter translation for {t}".format(t=msgid))
translation = str(input(">"))
if translation and len(translation) > 0:
# Update the line with the new translation
line = 'msgstr "{msg}"'.format(msg=translation)
out.append(line + "\r\n")
if save:
with open(filename, 'w') as output_file:
output_file.writelines(out)
print("Translation done: written to", filename)
print("Run 'make translate' to rebuild translation data")
if __name__ == '__main__':
MY_DIR = os.path.dirname(os.path.realpath(__file__))
LOCALE_DIR = os.path.join(MY_DIR, '..', 'locale')
if not os.path.exists(LOCALE_DIR):
print("Error: {d} does not exist!".format(d=LOCALE_DIR))
sys.exit(1)
parser = argparse.ArgumentParser(description="InvenTree Translation Helper")
parser.add_argument('language', help='Language code', action='store')
parser.add_argument('--fake', help="Do not save updated translations", action='store_true')
args = parser.parse_args()
language = args.language
LANGUAGE_DIR = os.path.abspath(os.path.join(LOCALE_DIR, language))
# Check that a locale directory exists for the given language!
if not os.path.exists(LANGUAGE_DIR):
print("Error: Locale directory for language '{l}' does not exist".format(l=language))
sys.exit(1)
# Check that a .po file exists for the given language!
PO_FILE = os.path.join(LANGUAGE_DIR, 'LC_MESSAGES', 'django.po')
if not os.path.exists(PO_FILE):
print("Error: File '{f}' does not exist".format(f=PO_FILE))
sys.exit(1)
# Ok, now we run the user through the translation file
manually_translate_file(PO_FILE, save=args.fake is not True)

View File

@ -0,0 +1,19 @@
# Generated by Django 3.0.5 on 2020-05-02 23:08
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0034_auto_20200426_0602'),
]
operations = [
migrations.AlterField(
model_name='stockitem',
name='status',
field=models.PositiveIntegerField(choices=[(10, 'OK'), (50, 'Attention needed'), (55, 'Damaged'), (60, 'Destroyed'), (70, 'Lost'), (65, 'Rejected'), (85, 'Returned'), (110, 'Shipped'), (120, 'Used for Build'), (130, 'Installed in Stock Item')], default=10, validators=[django.core.validators.MinValueValidator(0)]),
),
]

View File

@ -102,18 +102,19 @@ InvenTree
<script type='text/javascript' src="{% static 'script/inventree/inventree.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/api.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/part.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/bom.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/filters.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/tables.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/build.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/modals.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/order.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/company.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/sidenav.js' %}"></script>
<script type='text/javascript' src="{% url 'bom.js' %}"></script>
<script type='text/javascript' src="{% url 'company.js' %}"></script>
<script type='text/javascript' src="{% url 'part.js' %}"></script>
<script type='text/javascript' src="{% url 'stock.js' %}"></script>
<script type='text/javascript' src="{% url 'build.js' %}"></script>
<script type='text/javascript' src="{% url 'order.js' %}"></script>
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.js' %}"></script>

View File

@ -1,3 +1,5 @@
{% load i18n %}
/* BOM management functions.
* Requires follwing files to be loaded first:
* - api.js
@ -130,7 +132,7 @@ function loadBomTable(table, options) {
cols.push(
{
field: 'sub_part_detail.full_name',
title: 'Part',
title: '{% trans "Part" %}',
sortable: true,
formatter: function(value, row, index, field) {
var url = `/part/${row.sub_part}/`;
@ -138,7 +140,7 @@ function loadBomTable(table, options) {
// Display an extra icon if this part is an assembly
if (row.sub_part_detail.assembly) {
var text = `<span title='Open subassembly' class='fas fa-stream label-right'></span>`;
var text = `<span title='{% trans "Open subassembly" %}' class='fas fa-stream label-right'></span>`;
html += renderLink(text, `/part/${row.sub_part}/bom/`);
}
@ -152,14 +154,14 @@ function loadBomTable(table, options) {
cols.push(
{
field: 'sub_part_detail.description',
title: 'Description',
title: '{% trans "Description" %}',
}
);
// Part reference
cols.push({
field: 'reference',
title: 'Reference',
title: '{% trans "Reference" %}',
searchable: true,
sortable: true,
});
@ -167,7 +169,7 @@ function loadBomTable(table, options) {
// Part quantity
cols.push({
field: 'quantity',
title: 'Quantity',
title: '{% trans "Quantity" %}',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
@ -189,7 +191,7 @@ function loadBomTable(table, options) {
cols.push(
{
field: 'sub_part_detail.stock',
title: 'Available',
title: '{% trans "Available" %}',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
@ -198,7 +200,7 @@ function loadBomTable(table, options) {
var text = value;
if (value == null || value <= 0) {
text = `<span class='label label-warning'>No Stock</span>`;
text = `<span class='label label-warning'>{% trans "No Stock" %}</span>`;
}
return renderLink(text, url);
@ -208,13 +210,13 @@ function loadBomTable(table, options) {
cols.push(
{
field: 'price_range',
title: 'Price',
title: '{% trans "Price" %}',
sortable: true,
formatter: function(value, row, index, field) {
if (value) {
return value;
} else {
return "<span class='warning-msg'>No pricing available</span>";
return "<span class='warning-msg'>{% trans "No pricing available" %}</span>";
}
}
});
@ -224,7 +226,7 @@ function loadBomTable(table, options) {
cols.push(
{
field: 'note',
title: 'Notes',
title: '{% trans "Notes" %}',
searchable: true,
sortable: true,
}
@ -234,11 +236,11 @@ function loadBomTable(table, options) {
cols.push({
formatter: function(value, row, index, field) {
var bValidate = "<button title='Validate BOM Item' class='bom-validate-button btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-check-circle icon-blue'/></button>";
var bValid = "<span title='This line has been validated' class='fas fa-check-double icon-green'/>";
var bValidate = "<button title='{% trans "Validate BOM Item" %}' class='bom-validate-button btn btn-default btn-glyph' type='button' pk='" + row.pk + "'><span class='fas fa-check-circle icon-blue'/></button>";
var bValid = "<span title='{% trans "This line has been validated" %}' class='fas fa-check-double icon-green'/>";
var bEdit = "<button title='Edit BOM Item' class='bom-edit-button btn btn-default btn-glyph' type='button' url='/part/bom/" + row.pk + "/edit'><span class='fas fa-edit'/></button>";
var bDelt = "<button title='Delete BOM Item' class='bom-delete-button btn btn-default btn-glyph' type='button' url='/part/bom/" + row.pk + "/delete'><span class='fas fa-trash-alt icon-red'/></button>";
var bEdit = "<button title='{% trans "Edit BOM Item" %}' class='bom-edit-button btn btn-default btn-glyph' type='button' url='/part/bom/" + row.pk + "/edit'><span class='fas fa-edit'/></button>";
var bDelt = "<button title='{% trans "Delete BOM Item" %}' class='bom-delete-button btn btn-default btn-glyph' type='button' url='/part/bom/" + row.pk + "/delete'><span class='fas fa-trash-alt icon-red'/></button>";
var html = "<div class='btn-group' role='group'>";
@ -283,7 +285,7 @@ function loadBomTable(table, options) {
return {classes: 'rowinvalid'};
}
},
formatNoMatches: function() { return "No BOM items found"; },
formatNoMatches: function() { return "{% trans "No BOM items found" %}"; },
clickToSelect: true,
queryParams: function(p) {
return params;

View File

@ -1,3 +1,5 @@
{% load i18n %}
function loadBuildTable(table, options) {
// Display a table of Build objects
@ -14,7 +16,7 @@ function loadBuildTable(table, options) {
table.inventreeTable({
method: 'get',
formatNoMatches: function() {
return "No builds matching query";
return "{% trans "No builds matching query" %}";
},
url: options.url,
queryParams: filters,
@ -28,7 +30,7 @@ function loadBuildTable(table, options) {
},
{
field: 'title',
title: 'Build',
title: '{% trans "Build" %}',
sortable: true,
formatter: function(value, row, index, field) {
return renderLink(value, '/build/' + row.pk + '/');
@ -36,7 +38,7 @@ function loadBuildTable(table, options) {
},
{
field: 'part',
title: 'Part',
title: '{% trans "Part" %}',
sortable: true,
formatter: function(value, row, index, field) {
@ -47,12 +49,12 @@ function loadBuildTable(table, options) {
},
{
field: 'quantity',
title: 'Quantity',
title: '{% trans "Quantity" %}',
sortable: true,
},
{
field: 'status',
title: 'Status',
title: '{% trans "Status" %}',
sortable: true,
formatter: function(value, row, index, field) {
return buildStatusDisplay(value);
@ -60,12 +62,12 @@ function loadBuildTable(table, options) {
},
{
field: 'creation_date',
title: 'Created',
title: '{% trans "Created" %}',
sortable: true,
},
{
field: 'completion_date',
title: 'Completed',
title: '{% trans "Completed" %}',
sortable: true,
},
],
@ -97,30 +99,30 @@ function loadAllocationTable(table, part_id, part, url, required, button) {
table.bootstrapTable({
url: url,
sortable: false,
formatNoMatches: function() { return 'No parts allocated for ' + part; },
formatNoMatches: function() { return '{% trans "No parts allocated for" %} ' + part; },
columns: [
{
field: 'stock_item_detail',
title: 'Stock Item',
title: '{% trans "Stock Item" %}',
formatter: function(value, row, index, field) {
return '' + parseFloat(value.quantity) + ' x ' + value.part_name + ' @ ' + value.location_name;
}
},
{
field: 'stock_item_detail.quantity',
title: 'Available',
title: '{% trans "Available" %}',
formatter: function(value, row, index, field) {
return parseFloat(value);
}
},
{
field: 'quantity',
title: 'Allocated',
title: '{% trans "Allocated" %}',
formatter: function(value, row, index, field) {
var html = parseFloat(value);
var bEdit = "<button class='btn item-edit-button btn-sm' type='button' title='Edit stock allocation' url='/build/item/" + row.pk + "/edit/'><span class='fas fa-edit'></span></button>";
var bDel = "<button class='btn item-del-button btn-sm' type='button' title='Delete stock allocation' url='/build/item/" + row.pk + "/delete/'><span class='fas fa-trash-alt icon-red'></span></button>";
var bEdit = "<button class='btn item-edit-button btn-sm' type='button' title='{% trans "Edit stock allocation" %}' url='/build/item/" + row.pk + "/edit/'><span class='fas fa-edit'></span></button>";
var bDel = "<button class='btn item-del-button btn-sm' type='button' title='{% trans "Delete stock allocation" %}' url='/build/item/" + row.pk + "/delete/'><span class='fas fa-trash-alt icon-red'></span></button>";
html += "<div class='btn-group' style='float: right;'>" + bEdit + bDel + "</div>";

View File

@ -1,3 +1,4 @@
{% load i18n %}
function loadCompanyTable(table, url, options={}) {
/*
@ -25,7 +26,7 @@ function loadCompanyTable(table, url, options={}) {
method: 'get',
queryParams: filters,
groupBy: false,
formatNoMatches: function() { return "No company information found"; },
formatNoMatches: function() { return "{% trans "No company information found" %}"; },
columns: [
{
field: 'pk',
@ -34,21 +35,21 @@ function loadCompanyTable(table, url, options={}) {
},
{
field: 'name',
title: 'Company',
title: '{% trans "Company" %}',
sortable: true,
formatter: function(value, row, index, field) {
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
if (row.is_customer) {
html += `<span title='Customer' class='fas fa-user-tie label-right'></span>`;
html += `<span title='{% trans "Customer" %}' class='fas fa-user-tie label-right'></span>`;
}
if (row.is_manufacturer) {
html += `<span title='Manufacturer' class='fas fa-industry label-right'></span>`;
html += `<span title='{% trans "Manufacturer" %}' class='fas fa-industry label-right'></span>`;
}
if (row.is_supplier) {
html += `<span title='Supplier' class='fas fa-building label-right'></span>`;
html += `<span title='{% trans "Supplier" %}' class='fas fa-building label-right'></span>`;
}
return html;
@ -56,12 +57,12 @@ function loadCompanyTable(table, url, options={}) {
},
{
field: 'description',
title: 'Description',
title: '{% trans "Description" %}',
sortable: true,
},
{
field: 'website',
title: 'Website',
title: '{% trans "Website" %}',
formatter: function(value, row, index, field) {
if (value) {
return renderLink(value, value);
@ -97,7 +98,7 @@ function loadSupplierPartTable(table, url, options) {
method: 'get',
queryParams: filters,
groupBy: false,
formatNoMatches: function() { return "No supplier parts found"; },
formatNoMatches: function() { return "{% trans "No supplier parts found" %}"; },
columns: [
{
checkbox: true,
@ -105,7 +106,7 @@ function loadSupplierPartTable(table, url, options) {
{
sortable: true,
field: 'part_detail.full_name',
title: 'Part',
title: '{% trans "Part" %}',
formatter: function(value, row, index, field) {
var url = `/part/${row.part}/`;
@ -113,15 +114,15 @@ function loadSupplierPartTable(table, url, options) {
var html = imageHoverIcon(row.part_detail.thumbnail) + renderLink(value, url);
if (row.part_detail.is_template) {
html += `<span class='fas fa-clone label-right' title='Template part'></span>`;
html += `<span class='fas fa-clone label-right' title='{% trans "Template part" %}'></span>`;
}
if (row.part_detail.assembly) {
html += `<span class='fas fa-tools label-right' title='Assembled part'></span>`;
html += `<span class='fas fa-tools label-right' title='{% trans "Assembled part" %}'></span>`;
}
if (!row.part_detail.active) {
html += `<span class='label label-warning label-right'>INACTIVE</span>`;
html += `<span class='label label-warning label-right'>{% trans "Inactive" %}</span>`;
}
return html;
@ -130,7 +131,7 @@ function loadSupplierPartTable(table, url, options) {
{
sortable: true,
field: 'supplier',
title: "Supplier",
title: "{% trans "Supplier" %}",
formatter: function(value, row, index, field) {
if (value) {
var name = row.supplier_detail.name;
@ -146,7 +147,7 @@ function loadSupplierPartTable(table, url, options) {
{
sortable: true,
field: 'SKU',
title: "Supplier Part",
title: "{% trans "Supplier Part" %}",
formatter: function(value, row, index, field) {
return renderLink(value, `/supplier-part/${row.pk}/`);
}
@ -154,7 +155,7 @@ function loadSupplierPartTable(table, url, options) {
{
sortable: true,
field: 'manufacturer',
title: 'Manufacturer',
title: '{% trans "Manufacturer" %}',
formatter: function(value, row, index, field) {
if (value) {
var name = row.manufacturer_detail.name;
@ -170,11 +171,11 @@ function loadSupplierPartTable(table, url, options) {
{
sortable: true,
field: 'MPN',
title: 'MPN',
title: '{% trans "MPN" %}',
},
{
field: 'link',
title: 'Link',
title: '{% trans "Link" %}',
formatter: function(value, row, index, field) {
if (value) {
return renderLink(value, value);

View File

@ -1,3 +1,5 @@
{% load i18n %}
function removeOrderRowFromOrderWizard(e) {
/* Remove a part selection from an order form. */
@ -121,7 +123,7 @@ function loadPurchaseOrderTable(table, options) {
queryParams: filters,
groupBy: false,
original: options.params,
formatNoMatches: function() { return "No purchase orders found"; },
formatNoMatches: function() { return "{% trans "No purchase orders found" %}"; },
columns: [
{
field: 'pk',
@ -131,7 +133,7 @@ function loadPurchaseOrderTable(table, options) {
{
sortable: true,
field: 'reference',
title: 'Purchase Order',
title: '{% trans "Purchase Order" %}',
formatter: function(value, row, index, field) {
return renderLink(value, `/order/purchase-order/${row.pk}/`);
}
@ -139,25 +141,25 @@ function loadPurchaseOrderTable(table, options) {
{
sortable: true,
field: 'supplier_detail',
title: 'Supplier',
title: '{% trans "Supplier" %}',
formatter: function(value, row, index, field) {
return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`);
}
},
{
field: 'supplier_reference',
title: 'Supplier Reference',
title: '{% trans "Supplier Reference" %}',
sortable: true,
},
{
sortable: true,
field: 'description',
title: 'Description',
title: '{% trans "Description" %}',
},
{
sortable: true,
field: 'status',
title: 'Status',
title: '{% trans "Status" %}',
formatter: function(value, row, index, field) {
return purchaseOrderStatusDisplay(row.status, row.status_text);
}
@ -165,12 +167,12 @@ function loadPurchaseOrderTable(table, options) {
{
sortable: true,
field: 'creation_date',
title: 'Date',
title: '{% trans "Date" %}',
},
{
sortable: true,
field: 'line_items',
title: 'Items'
title: '{% trans "Items" %}'
},
],
});
@ -194,7 +196,7 @@ function loadSalesOrderTable(table, options) {
queryParams: filters,
groupBy: false,
original: options.params,
formatNoMatches: function() { return "No sales orders found"; },
formatNoMatches: function() { return "{% trans "No sales orders found" %}"; },
columns: [
{
field: 'pk',
@ -204,7 +206,7 @@ function loadSalesOrderTable(table, options) {
{
sortable: true,
field: 'reference',
title: 'Sales Order',
title: '{% trans "Sales Order" %}',
formatter: function(value, row, index, field) {
return renderLink(value, `/order/sales-order/${row.pk}/`);
},
@ -212,25 +214,25 @@ function loadSalesOrderTable(table, options) {
{
sortable: true,
field: 'customer_detail',
title: 'Customer',
title: '{% trans "Customer" %}',
formatter: function(value, row, index, field) {
return imageHoverIcon(row.customer_detail.image) + renderLink(row.customer_detail.name, `/company/${row.customer}/sales-orders/`);
}
},
{
field: 'customer_reference',
title: 'Customer Reference',
title: '{% trans "Customer Reference" %}',
sotrable: true,
},
{
sortable: true,
field: 'description',
title: 'Description',
title: '{% trans "Description" %}',
},
{
sortable: true,
field: 'status',
title: 'Status',
title: '{% trans "Status" %}',
formatter: function(value, row, index, field) {
return salesOrderStatusDisplay(row.status, row.status_text);
}
@ -238,17 +240,17 @@ function loadSalesOrderTable(table, options) {
{
sortable: true,
field: 'creation_date',
title: 'Creation Date',
title: '{% trans "Creation Date" %}',
},
{
sortable: true,
field: 'shipment_date',
title: "Shipment Date",
title: "{% trans "Shipment Date" %}",
},
{
sortable: true,
field: 'line_items',
title: 'Items'
title: '{% trans "Items" %}'
},
],
});

View File

@ -1,23 +1,9 @@
{% load i18n %}
/* Part API functions
* Requires api.js to be loaded first
*/
function getPartCategoryList(filters={}, options={}) {
return inventreeGet('/api/part/category/', filters, options);
}
function getSupplierPartList(filters={}, options={}) {
return inventreeGet('/api/part/supplier/', filters, options);
}
function getPartList(filters={}, options={}) {
return inventreeGet('/api/part/', filters, options);
}
function getBomList(filters={}, options={}) {
return inventreeGet('/api/bom/', filters, options);
}
function toggleStar(options) {
/* Toggle the 'starred' status of a part.
* Performs AJAX queries and updates the display on the button.
@ -115,14 +101,14 @@ function loadPartTable(table, url, options={}) {
if (options.checkbox) {
columns.push({
checkbox: true,
title: 'Select',
title: '{% trans 'Select' %}',
searchable: false,
});
}
columns.push({
field: 'name',
title: 'Part',
title: '{% trans 'Part' %}',
sortable: true,
formatter: function(value, row, index, field) {
@ -147,19 +133,19 @@ function loadPartTable(table, url, options={}) {
var display = imageHoverIcon(row.thumbnail) + renderLink(name, '/part/' + row.pk + '/');
if (row.is_template) {
display += `<span class='fas fa-clone label-right' title='Template part'></span>`;
display += `<span class='fas fa-clone label-right' title='{% trans "Template part" %}'></span>`;
}
if (row.assembly) {
display += `<span class='fas fa-tools label-right' title='Assembled part'></span>`;
display += `<span class='fas fa-tools label-right' title='{% trans "Assembled part" %}'></span>`;
}
if (row.starred) {
display += `<span class='fas fa-star label-right' title='Starred part'></span>`;
display += `<span class='fas fa-star label-right' title='{% trans "Starred part" %}'></span>`;
}
if (row.salable) {
display += `<span class='fas fa-dollar-sign label-right' title='Salable part'></span>`;
display += `<span class='fas fa-dollar-sign label-right' title='{% trans "Salable part" %}'></span>`;
}
/*
@ -169,7 +155,7 @@ function loadPartTable(table, url, options={}) {
*/
if (!row.active) {
display += `<span class='label label-warning label-right'>INACTIVE</span>`;
display += `<span class='label label-warning label-right'>{% trans "Inactive" %}</span>`;
}
return display;
}
@ -178,7 +164,7 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'description',
title: 'Description',
title: '{% trans 'Description' %}',
formatter: function(value, row, index, field) {
if (row.is_template) {
@ -192,20 +178,20 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'category_detail',
title: 'Category',
title: '{% trans 'Category' %}',
formatter: function(value, row, index, field) {
if (row.category) {
return renderLink(value.pathstring, "/part/category/" + row.category + "/");
}
else {
return 'No category';
return '{% trans "No category" %}';
}
}
});
columns.push({
field: 'in_stock',
title: 'Stock',
title: '{% trans "Stock" %}',
searchable: false,
sortable: true,
formatter: function(value, row, index, field) {
@ -216,20 +202,20 @@ function loadPartTable(table, url, options={}) {
// Is stock "low" (below the 'minimum_stock' quantity)?
if (row.minimum_stock && row.minimum_stock > value) {
value += "<span class='label label-right label-warning'>Low stock</span>";
value += "<span class='label label-right label-warning'>{% trans "Low stock" %}</span>";
}
} else if (row.on_order) {
// There is no stock available, but stock is on order
value = "0<span class='label label-right label-primary'>On Order : " + row.on_order + "</span>";
value = "0<span class='label label-right label-primary'>{% trans "On Order" %}: " + row.on_order + "</span>";
link = "orders";
} else if (row.building) {
// There is no stock available, but stock is being built
value = "0<span class='label label-right label-info'>Building : " + row.building + "</span>";
value = "0<span class='label label-right label-info'>{% trans "Building" %}: " + row.building + "</span>";
link = "builds";
} else {
// There is no stock available
value = "0<span class='label label-right label-danger'>No Stock</span>";
value = "0<span class='label label-right label-danger'>{% trans "No Stock" %}</span>";
}
return renderLink(value, '/part/' + row.pk + "/" + link + "/");
@ -243,7 +229,7 @@ function loadPartTable(table, url, options={}) {
queryParams: filters,
groupBy: false,
original: params,
formatNoMatches: function() { return "No parts found"; },
formatNoMatches: function() { return "{% trans "No parts found" %}"; },
columns: columns,
});

View File

@ -1,20 +1,9 @@
{% load i18n %}
/* Stock API functions
* Requires api.js to be loaded first
*/
function getStockList(filters={}, options={}) {
return inventreeGet('/api/stock/', filters, options);
}
function getStockDetail(pk, options={}) {
return inventreeGet('/api/stock/' + pk + '/', {}, options)
}
function getStockLocations(filters={}, options={}) {
return inventreeGet('/api/stock/location/', filters, options)
}
/* Functions for interacting with stock management forms
*/
@ -29,7 +18,6 @@ function removeStockRow(e) {
$('#' + row).remove();
}
function loadStockTable(table, options) {
/* Load data into a stock table with adjustable options.
* Fetches data (via AJAX) and loads into a bootstrap table.
@ -75,7 +63,7 @@ function loadStockTable(table, options) {
table.inventreeTable({
method: 'get',
formatNoMatches: function() {
return 'No stock items matching query';
return '{% trans "No stock items matching query" %}';
},
url: options.url,
queryParams: filters,
@ -205,7 +193,7 @@ function loadStockTable(table, options) {
columns: [
{
checkbox: true,
title: 'Select',
title: '{% trans "Select" %}',
searchable: false,
},
{
@ -215,7 +203,7 @@ function loadStockTable(table, options) {
},
{
field: 'part_name',
title: 'Part',
title: '{% trans "Part" %}',
sortable: true,
formatter: function(value, row, index, field) {
@ -236,7 +224,7 @@ function loadStockTable(table, options) {
},
{
field: 'part_description',
title: 'Description',
title: '{% trans "Description" %}',
sortable: true,
formatter: function(value, row, index, field) {
return row.part_detail.description;
@ -244,7 +232,7 @@ function loadStockTable(table, options) {
},
{
field: 'quantity',
title: 'Stock',
title: '{% trans "Stock" %}',
sortable: true,
formatter: function(value, row, index, field) {
@ -260,12 +248,12 @@ function loadStockTable(table, options) {
var html = renderLink(val, `/stock/item/${row.pk}/`);
if (row.allocated) {
html += `<span class='fas fa-bookmark label-right' title='StockItem has been allocated'></span>`;
html += `<span class='fas fa-bookmark label-right' title='{% trans "StockItem has been allocated" %}'></span>`;
}
// 70 = "LOST"
if (row.status == 70) {
html += `<span class='fas fa-question-circle label-right' title='StockItem is lost'></span>`;
html += `<span class='fas fa-question-circle label-right' title='{% trans "StockItem is lost" %}'></span>`;
}
return html;
@ -273,7 +261,7 @@ function loadStockTable(table, options) {
},
{
field: 'status',
title: 'Status',
title: '{% trans "Status" %}',
sortable: 'true',
formatter: function(value, row, index, field) {
return stockStatusDisplay(value);
@ -281,25 +269,25 @@ function loadStockTable(table, options) {
},
{
field: 'batch',
title: 'Batch',
title: '{% trans "Batch" %}',
sortable: true,
},
{
field: 'location_detail.pathstring',
title: 'Location',
title: '{% trans "Location" %}',
sortable: true,
formatter: function(value, row, index, field) {
if (value) {
return renderLink(value, '/stock/location/' + row.location + '/');
}
else {
return '<i>No stock location set</i>';
return '<i>{% trans "No stock location set" %}</i>';
}
}
},
{
field: 'notes',
title: 'Notes',
title: '{% trans "Notes" %}',
}
],
});
@ -389,7 +377,6 @@ function loadStockTable(table, options) {
});
}
function loadStockTrackingTable(table, options) {
var cols = [
@ -399,7 +386,7 @@ function loadStockTrackingTable(table, options) {
},
{
field: 'date',
title: 'Date',
title: '{% trans "Date" %}',
sortable: true,
formatter: function(value, row, index, field) {
var m = moment(value);
@ -417,7 +404,7 @@ function loadStockTrackingTable(table, options) {
if (options.partColumn) {
cols.push({
field: 'item',
title: 'Stock Item',
title: '{% trans "Stock Item" %}',
sortable: true,
formatter: function(value, row, index, field) {
return renderLink(value.part_name, value.url);
@ -428,7 +415,7 @@ function loadStockTrackingTable(table, options) {
// Stock transaction description
cols.push({
field: 'title',
title: 'Description',
title: '{% trans "Description" %}',
sortable: true,
formatter: function(value, row, index, field) {
var html = "<b>" + value + "</b>";
@ -447,7 +434,7 @@ function loadStockTrackingTable(table, options) {
cols.push({
field: 'quantity',
title: 'Quantity',
title: '{% trans "Quantity" %}',
formatter: function(value, row, index, field) {
return parseFloat(value);
},
@ -456,7 +443,7 @@ function loadStockTrackingTable(table, options) {
cols.push({
sortable: true,
field: 'user',
title: 'User',
title: '{% trans "User" %}',
formatter: function(value, row, index, field) {
if (value)
{
@ -465,7 +452,7 @@ function loadStockTrackingTable(table, options) {
}
else
{
return "No user information";
return "{% trans "No user information" %}";
}
}
});