diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 0aab04f941..eed6c6ad21 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -957,3 +957,7 @@ input[type="date"].form-control, input[type="time"].form-control, input[type="da .clip-btn:hover { background: var(--label-grey); } + +.sidebar-icon { + min-width: 19px; +} \ No newline at end of file diff --git a/InvenTree/build/templates/build/navbar.html b/InvenTree/build/templates/build/navbar.html index 34d3b9e9e4..e6d2e644ce 100644 --- a/InvenTree/build/templates/build/navbar.html +++ b/InvenTree/build/templates/build/navbar.html @@ -11,7 +11,7 @@
  • - + {% trans "Details" %}
  • @@ -20,7 +20,7 @@
  • - + {% trans "Allocate Stock" %}
  • @@ -28,28 +28,28 @@
  • - + {% trans "Build Outputs" %}
  • - + {% trans "Child Builds" %}
  • - + {% trans "Attachments" %}
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 236e48770f..ec76475901 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -703,7 +703,7 @@ class PriceBreak(models.Model): price = MoneyField( max_digits=19, decimal_places=4, - default_currency='USD', + default_currency=currency_code_default(), null=True, verbose_name=_('Price'), help_text=_('Unit price at specified quantity'), diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index 62a46fcd6f..6ffa94b746 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -14,7 +14,7 @@ import django.forms import djmoney.settings from djmoney.forms.fields import MoneyField -import common.settings +from common.settings import currency_code_default from .models import Company from .models import ManufacturerPart @@ -38,7 +38,7 @@ class EditCompanyForm(HelperForm): label=_('Currency'), help_text=_('Default currency used for this company'), choices=[('', '----------')] + djmoney.settings.CURRENCY_CHOICES, - initial=common.settings.currency_code_default, + initial=currency_code_default, ) class Meta: @@ -116,7 +116,7 @@ class EditSupplierPartForm(HelperForm): single_pricing = MoneyField( label=_('Single Price'), - default_currency='USD', + default_currency=currency_code_default(), help_text=_('Single quantity price'), decimal_places=4, max_digits=19, diff --git a/InvenTree/company/templates/company/manufacturer_part_navbar.html b/InvenTree/company/templates/company/manufacturer_part_navbar.html index 96b6bec699..3eae30afaf 100644 --- a/InvenTree/company/templates/company/manufacturer_part_navbar.html +++ b/InvenTree/company/templates/company/manufacturer_part_navbar.html @@ -10,7 +10,7 @@
  • - + {% trans "Suppliers" %}
  • @@ -18,14 +18,14 @@ {% comment "for later" %}
  • - + {% trans "Stock" %}
  • - + {% trans "Orders" %}
  • diff --git a/InvenTree/company/templates/company/navbar.html b/InvenTree/company/templates/company/navbar.html index 8804dc2635..715d448b0f 100644 --- a/InvenTree/company/templates/company/navbar.html +++ b/InvenTree/company/templates/company/navbar.html @@ -11,7 +11,7 @@
  • - + {% trans "Details" %}
  • @@ -19,7 +19,7 @@ {% if company.is_manufacturer %}
  • - + {% trans "Manufactured Parts" %}
  • @@ -28,7 +28,7 @@ {% if company.is_supplier or company.is_manufacturer %}
  • - + {% trans "Supplied Parts" %}
  • @@ -37,7 +37,7 @@ {% if company.is_manufacturer or company.is_supplier %}
  • - + {% trans "Stock" %}
  • @@ -46,7 +46,7 @@ {% if company.is_supplier %}
  • - + {% trans "Purchase Orders" %}
  • @@ -55,13 +55,13 @@ {% if company.is_customer %}
  • - + {% trans "Sales Orders" %}
  • - + {% trans "Assigned Stock" %}
  • @@ -69,7 +69,7 @@
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/company/templates/company/supplier_part_navbar.html b/InvenTree/company/templates/company/supplier_part_navbar.html index 09c3bc0443..e52c1798ba 100644 --- a/InvenTree/company/templates/company/supplier_part_navbar.html +++ b/InvenTree/company/templates/company/supplier_part_navbar.html @@ -11,21 +11,21 @@
  • - + {% trans "Stock" %}
  • - + {% trans "Orders" %}
  • - + {% trans "Pricing" %}
  • diff --git a/InvenTree/company/templates/company/supplier_part_pricing.html b/InvenTree/company/templates/company/supplier_part_pricing.html index febae74f47..9da3f3df7e 100644 --- a/InvenTree/company/templates/company/supplier_part_pricing.html +++ b/InvenTree/company/templates/company/supplier_part_pricing.html @@ -40,7 +40,7 @@ $('#price-break-table').inventreeTable({ part: {{ part.id }}, }, url: "{% url 'api-part-supplier-price' %}", - onLoadSuccess: function() { + onPostBody: function() { var table = $('#price-break-table'); table.find('.button-price-break-delete').click(function() { diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index fb169e0536..49504b6d89 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -17,6 +17,8 @@ from django.contrib.auth.models import User from django.urls import reverse from django.utils.translation import ugettext_lazy as _ +from common.settings import currency_code_default + from markdownx.models import MarkdownxField from djmoney.models.fields import MoneyField @@ -664,7 +666,7 @@ class PurchaseOrderLineItem(OrderLineItem): purchase_price = MoneyField( max_digits=19, decimal_places=4, - default_currency='USD', + default_currency=currency_code_default(), null=True, blank=True, verbose_name=_('Purchase Price'), help_text=_('Unit purchase price'), @@ -693,7 +695,7 @@ class SalesOrderLineItem(OrderLineItem): sale_price = MoneyField( max_digits=19, decimal_places=4, - default_currency='USD', + default_currency=currency_code_default(), null=True, blank=True, verbose_name=_('Sale Price'), help_text=_('Unit sale price'), diff --git a/InvenTree/order/templates/order/po_navbar.html b/InvenTree/order/templates/order/po_navbar.html index f8e818c2e3..4dc501a8d6 100644 --- a/InvenTree/order/templates/order/po_navbar.html +++ b/InvenTree/order/templates/order/po_navbar.html @@ -11,33 +11,33 @@
  • - + {% trans "Details" %}
  • {% if order.status == PurchaseOrderStatus.PENDING and roles.purchase_order.change %}
  • - + {% trans "Upload File" %}
  • {% endif %}
  • - + {% trans "Received Items" %}
  • - + {% trans "Attachments" %}
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/order/templates/order/so_navbar.html b/InvenTree/order/templates/order/so_navbar.html index 847e0a22f6..4623febd02 100644 --- a/InvenTree/order/templates/order/so_navbar.html +++ b/InvenTree/order/templates/order/so_navbar.html @@ -11,28 +11,28 @@
  • - + {% trans "Details" %}
  • - + {% trans "Build Orders" %}
  • - + {% trans "Attachments" %}
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/part/templates/part/category_navbar.html b/InvenTree/part/templates/part/category_navbar.html index e723db358d..d84b49a311 100644 --- a/InvenTree/part/templates/part/category_navbar.html +++ b/InvenTree/part/templates/part/category_navbar.html @@ -14,7 +14,7 @@ {% else %} {% endif %} - + {% trans "Subcategories" %} @@ -25,7 +25,7 @@ {% else %} {% endif %} - + {% trans "Parts" %} @@ -33,7 +33,7 @@ {% if category %}
  • - + {% trans "Parameters" %}
  • diff --git a/InvenTree/part/templates/part/navbar.html b/InvenTree/part/templates/part/navbar.html index a2c8104486..d1ed7e3d21 100644 --- a/InvenTree/part/templates/part/navbar.html +++ b/InvenTree/part/templates/part/navbar.html @@ -10,7 +10,7 @@
  • - + {% trans "Details" %} @@ -18,28 +18,28 @@
  • - + {% trans "Parameters" %}
  • {% if part.is_template %}
  • - + {% trans "Variants" %}
  • {% endif %}
  • - + {% trans "Stock" %}
  • {% if part.component or part.salable %}
  • - + {% trans "Allocations" %}
  • @@ -47,14 +47,14 @@ {% if part.assembly %}
  • - + {% trans "Bill of Materials" %}
  • {% if roles.build.view %}
  • - + {% trans "Build Orders" %}
  • @@ -63,7 +63,7 @@ {% if part.component %}
  • - + {% trans "Used In" %}
  • @@ -71,25 +71,25 @@ {% if part.purchaseable and roles.purchase_order.view %}
  • - + {% trans "Order Price" %}
  • - + {% trans "Manufacturers" %}
  • - + {% trans "Suppliers" %}
  • - + {% trans "Purchase Orders" %}
  • @@ -97,13 +97,13 @@ {% if part.salable and roles.sales_order.view %}
  • - + {% trans "Sale Price" %}
  • - + {% trans "Sales Orders" %}
  • @@ -111,26 +111,26 @@ {% if part.trackable %}
  • - + {% trans "Tests" %}
  • {% endif %}
  • - + {% trans "Related Parts" %}
  • - + {% trans "Attachments" %}
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/part/templates/part/order_prices.html b/InvenTree/part/templates/part/order_prices.html index 6c5b2173bf..e165ee9c74 100644 --- a/InvenTree/part/templates/part/order_prices.html +++ b/InvenTree/part/templates/part/order_prices.html @@ -13,7 +13,7 @@ {% endblock %} {% block details %} -{% settings_value "INVENTREE_DEFAULT_CURRENCY" as currency %} +{% default_currency as currency %} {% crispy form %} @@ -130,7 +130,7 @@ the part single price shown is the current price for that supplier part"> {% trans 'Part' %} diff --git a/InvenTree/part/templates/part/sale_prices.html b/InvenTree/part/templates/part/sale_prices.html index f19d65a59a..4ec826e2a6 100644 --- a/InvenTree/part/templates/part/sale_prices.html +++ b/InvenTree/part/templates/part/sale_prices.html @@ -48,7 +48,7 @@ $('#price-break-table').inventreeTable({ part: {{ part.id }}, }, url: "{% url 'api-part-sale-price-list' %}", - onLoadSuccess: function() { + onPostBody: function() { var table = $('#price-break-table'); table.find('.button-price-break-delete').click(function() { diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index ceb2d11e31..1c40dae30e 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -18,6 +18,7 @@ from InvenTree import version, settings import InvenTree.helpers from common.models import InvenTreeSetting, ColorTheme +from common.settings import currency_code_default register = template.Library() @@ -161,6 +162,12 @@ def inventree_credits_url(*args, **kwargs): return "https://inventree.readthedocs.io/en/latest/credits/" +@register.simple_tag() +def default_currency(*args, **kwargs): + """ Returns the default currency code """ + return currency_code_default() + + @register.simple_tag() def setting_object(key, *args, **kwargs): """ diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 88f8dd081c..9786b360d9 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -20,6 +20,8 @@ from django.contrib.auth.models import User from django.db.models.signals import pre_delete from django.dispatch import receiver +from common.settings import currency_code_default + from markdownx.models import MarkdownxField from mptt.models import MPTTModel, TreeForeignKey @@ -534,7 +536,7 @@ class StockItem(MPTTModel): purchase_price = MoneyField( max_digits=19, decimal_places=4, - default_currency='USD', + default_currency=currency_code_default(), blank=True, null=True, verbose_name=_('Purchase Price'), diff --git a/InvenTree/stock/templates/stock/location_navbar.html b/InvenTree/stock/templates/stock/location_navbar.html index 0cb0c9d1eb..a4974d0d37 100644 --- a/InvenTree/stock/templates/stock/location_navbar.html +++ b/InvenTree/stock/templates/stock/location_navbar.html @@ -14,7 +14,7 @@ {% else %} {% endif %} - + {% trans "Sublocations" %} @@ -25,7 +25,7 @@ {% else %} {% endif %} - + {% trans "Stock Items" %} diff --git a/InvenTree/stock/templates/stock/navbar.html b/InvenTree/stock/templates/stock/navbar.html index 28a0bb2a5d..7c7d197a1a 100644 --- a/InvenTree/stock/templates/stock/navbar.html +++ b/InvenTree/stock/templates/stock/navbar.html @@ -10,7 +10,7 @@
  • - + {% trans "History" %}
  • @@ -18,7 +18,7 @@ {% if item.part.trackable %}
  • - + {% trans "Test Data" %}
  • @@ -26,7 +26,7 @@ {% if item.part.assembly %}
  • - + {% trans "Installed Items" %}
  • @@ -37,7 +37,7 @@ {% if item.child_count > 0 %}
  • - + {% trans "Children" %}
  • @@ -46,14 +46,14 @@
  • - + {% trans "Attachments" %}
  • - + {% trans "Notes" %}
  • diff --git a/InvenTree/templates/price.html b/InvenTree/templates/price.html index ef47d5edf2..285f785178 100644 --- a/InvenTree/templates/price.html +++ b/InvenTree/templates/price.html @@ -1 +1,2 @@ -{% if currency %}{{ currency.symbol }}{% endif %}{{ price }}{% if currency %} {{ currency.suffix }}{% endif %} \ No newline at end of file +{% load djmoney %} +{% money_localize price currency %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4f592bf9ab..66dabae630 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ invoke>=1.4.0 # Invoke build tool wheel>=0.34.2 # Wheel -Django==3.2 # Django package +Django==3.2.1 # Django package pillow==8.1.1 # Image manipulation djangorestframework==3.12.4 # DRF framework django-cors-headers==3.2.0 # CORS headers extension for DRF