From ffaa6ee3a92ac7b1d56d1b1fdbd647008d3c39b7 Mon Sep 17 00:00:00 2001 From: eeintech Date: Tue, 1 Jun 2021 14:22:00 -0400 Subject: [PATCH 1/8] Fixed price break row actions after sorting --- InvenTree/company/templates/company/supplier_part_pricing.html | 2 +- InvenTree/part/templates/part/sale_prices.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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() { From 7d7e518c1bc5e4f0a97fe9624a453cde02ff6e3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Jun 2021 21:37:26 +0000 Subject: [PATCH 2/8] Bump django from 3.2 to 3.2.1 Bumps [django](https://github.com/django/django) from 3.2 to 3.2.1. - [Release notes](https://github.com/django/django/releases) - [Commits](https://github.com/django/django/compare/3.2...3.2.1) --- updated-dependencies: - dependency-name: django dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From d87592aedb209e34562c6a443221ddec66673cb2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 13:22:11 +0200 Subject: [PATCH 3/8] use the default currency in forms --- InvenTree/common/models.py | 2 +- InvenTree/company/forms.py | 5 +++-- InvenTree/order/models.py | 6 ++++-- InvenTree/stock/models.py | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) 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..fc409b9a77 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -15,6 +15,7 @@ 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 +39,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 +117,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/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/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'), From 691142ea4c539a252bcc468a5cfd704e27ca7687 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 13:27:39 +0200 Subject: [PATCH 4/8] fixing currency display --- InvenTree/part/templates/part/part_pricing.html | 3 ++- InvenTree/templates/price.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html index 49e37fe0ad..cc036a5884 100644 --- a/InvenTree/part/templates/part/part_pricing.html +++ b/InvenTree/part/templates/part/part_pricing.html @@ -1,8 +1,9 @@ {% extends "modal_form.html" %} -{% load i18n %} +{% load i18n inventree_extras %} {% block pre_form_content %} +{% settings_value "INVENTREE_DEFAULT_CURRENCY" as currency %} 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 From 0eff7d000af96d779f88e5e24ec6738b989d4767 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 15:05:05 +0200 Subject: [PATCH 5/8] added tag to replace dynamic setting --- InvenTree/part/templatetags/inventree_extras.py | 7 +++++++ 1 file changed, 7 insertions(+) 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): """ From 44717b646f48fb60c3f4dd526cfb289e8b883893 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 15:07:42 +0200 Subject: [PATCH 6/8] using new tag for currency --- InvenTree/part/templates/part/order_prices.html | 4 ++-- InvenTree/part/templates/part/part_pricing.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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"> From 05d79a4c1949972d822b8a2b51aeda9c788451db Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 15:18:08 +0200 Subject: [PATCH 7/8] same nav sidebar distance for everything --- InvenTree/InvenTree/static/css/inventree.css | 4 +++ InvenTree/build/templates/build/navbar.html | 12 +++---- .../company/manufacturer_part_navbar.html | 6 ++-- .../company/templates/company/navbar.html | 16 ++++----- .../company/supplier_part_navbar.html | 6 ++-- .../order/templates/order/po_navbar.html | 10 +++--- .../order/templates/order/so_navbar.html | 8 ++--- .../part/templates/part/category_navbar.html | 6 ++-- InvenTree/part/templates/part/navbar.html | 36 +++++++++---------- .../templates/stock/location_navbar.html | 4 +-- InvenTree/stock/templates/stock/navbar.html | 12 +++---- 11 files changed, 62 insertions(+), 58 deletions(-) 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/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/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/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" %}
  • From 0bac7ebf3e1b0eee48f6fa36005de61238b7b520 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 5 Jun 2021 17:18:46 +0200 Subject: [PATCH 8/8] styling --- InvenTree/company/forms.py | 1 - 1 file changed, 1 deletion(-) diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index fc409b9a77..6ffa94b746 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -14,7 +14,6 @@ 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
    {% trans 'Part' %}
    {% trans 'Part' %}