From 5264f816f1484f7fbc10300af11cfd03bf3b2010 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 2 Feb 2020 21:40:03 +1100 Subject: [PATCH 1/6] Allow PartCategory and StocKLocation names to be non-unique - As long as they are unique in the current tree level --- InvenTree/InvenTree/models.py | 3 ++- .../migrations/0027_auto_20200202_1024.py | 19 +++++++++++++++++++ .../migrations/0019_auto_20200202_1024.py | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 InvenTree/part/migrations/0027_auto_20200202_1024.py create mode 100644 InvenTree/stock/migrations/0019_auto_20200202_1024.py diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index d5259b2acc..a60935b4b6 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -29,6 +29,8 @@ class InvenTreeTree(MPTTModel): class Meta: abstract = True + + # Names must be unique at any given level in the tree unique_together = ('name', 'parent') class MPTTMeta: @@ -37,7 +39,6 @@ class InvenTreeTree(MPTTModel): name = models.CharField( blank=False, max_length=100, - unique=True, validators=[validate_tree_name] ) diff --git a/InvenTree/part/migrations/0027_auto_20200202_1024.py b/InvenTree/part/migrations/0027_auto_20200202_1024.py new file mode 100644 index 0000000000..61def4af5e --- /dev/null +++ b/InvenTree/part/migrations/0027_auto_20200202_1024.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.9 on 2020-02-02 10:24 + +import InvenTree.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0026_auto_20200131_1022'), + ] + + operations = [ + migrations.AlterField( + model_name='partcategory', + name='name', + field=models.CharField(max_length=100, validators=[InvenTree.validators.validate_tree_name]), + ), + ] diff --git a/InvenTree/stock/migrations/0019_auto_20200202_1024.py b/InvenTree/stock/migrations/0019_auto_20200202_1024.py new file mode 100644 index 0000000000..8dc67afb61 --- /dev/null +++ b/InvenTree/stock/migrations/0019_auto_20200202_1024.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.9 on 2020-02-02 10:24 + +import InvenTree.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0018_auto_20200202_0103'), + ] + + operations = [ + migrations.AlterField( + model_name='stocklocation', + name='name', + field=models.CharField(max_length=100, validators=[InvenTree.validators.validate_tree_name]), + ), + ] From d0a7a2464904a4f95cdbb87d4ab4fe92762f0a2c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 2 Feb 2020 21:43:10 +1100 Subject: [PATCH 2/6] Add translatable strings --- .../templates/company/company_base.html | 13 +- .../company/templates/company/detail.html | 7 +- .../templates/company/detail_part.html | 19 +- .../company/detail_purchase_orders.html | 5 +- .../templates/company/detail_stock.html | 5 +- .../company/templates/company/index.html | 17 +- .../templates/company/order_detail.html | 49 ---- .../company/templates/company/partdetail.html | 41 ++-- InvenTree/locale/de/LC_MESSAGES/django.po | 231 +++++++++++++++--- InvenTree/locale/en/LC_MESSAGES/django.po | 211 +++++++++++++--- InvenTree/locale/es/LC_MESSAGES/django.po | 211 +++++++++++++--- InvenTree/templates/InvenTree/search.html | 7 +- .../InvenTree/search_stock_location.html | 4 +- 13 files changed, 610 insertions(+), 210 deletions(-) delete mode 100644 InvenTree/company/templates/company/order_detail.html diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index 1063f967f5..1080f01445 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -1,9 +1,10 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block page_title %} -InvenTree | Company - {{ company.name }} +InvenTree | {% trans "Company" %} - {{ company.name }} {% endblock %} {% block content %} @@ -44,27 +45,27 @@ InvenTree | Company - {{ company.name }} {% if company.website %} - + {% endif %} {% if company.address %} - + {% endif %} {% if company.phone %} - + {% endif %} {% if company.email %} - + {% endif %} {% if company.contact %} - + {% endif %}
Website{{ company.website }}{% trans "Website" %}{{ company.website }}
Address{{ company.address }}{% trans "Address" %}{{ company.address }}
Phone{{ company.phone }}{% trans "Phone" %}{{ company.phone }}
Email{{ company.email }}{% trans "Email" %}{{ company.email }}
Contact{{ company.contact }}{% trans "Contact" %}{{ company.contact }}
diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 872d7f675e..93e9e5bbb9 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -1,19 +1,20 @@ {% extends "company/company_base.html" %} {% load static %} +{% load i18n %}} {% block details %} {% include 'company/tabs.html' with tab='details' %} -

Company Details

+

{% trans "Company Details" %}


- + - +
Customer{% trans "Customer" %} {% include 'yesnolabel.html' with value=company.is_customer %}
Supplier{% trans "Supplier" %} {% include 'yesnolabel.html' with value=company.is_supplier %}
diff --git a/InvenTree/company/templates/company/detail_part.html b/InvenTree/company/templates/company/detail_part.html index f1e5ab8632..7eac2b7bfe 100644 --- a/InvenTree/company/templates/company/detail_part.html +++ b/InvenTree/company/templates/company/detail_part.html @@ -1,21 +1,22 @@ {% extends "company/company_base.html" %} {% load static %} {% block details %} +{% load i18n %} {% include 'company/tabs.html' with tab='parts' %} -

Supplier Parts

+

{% trans "Supplier Parts" %}


- +
@@ -61,7 +62,7 @@ { sortable: true, field: 'part_detail.full_name', - title: 'Part', + title: '{% trans "Part" %}', formatter: function(value, row, index, field) { return imageHoverIcon(row.part_detail.image_url) + renderLink(value, '/part/' + row.part + '/suppliers/'); } @@ -69,7 +70,7 @@ { sortable: true, field: 'SKU', - title: 'SKU', + title: '{% trans "SKU" %}', formatter: function(value, row, index, field) { return renderLink(value, row.url); } @@ -77,7 +78,7 @@ { sortable: true, field: 'manufacturer', - title: 'Manufacturer', + title: '{% trans "Manufacturer" %}', }, { sortable: true, @@ -86,7 +87,7 @@ }, { field: 'URL', - title: 'URL', + title: '{% trans "URL" %}', formatter: function(value, row, index, field) { if (value) { return renderLink(value, value); diff --git a/InvenTree/company/templates/company/detail_purchase_orders.html b/InvenTree/company/templates/company/detail_purchase_orders.html index b2eabc129d..fcba26e2af 100644 --- a/InvenTree/company/templates/company/detail_purchase_orders.html +++ b/InvenTree/company/templates/company/detail_purchase_orders.html @@ -1,15 +1,16 @@ {% extends "company/company_base.html" %} {% load static %} {% block details %} +{% load i18n %} {% include 'company/tabs.html' with tab='po' %} -

Open Purchase Orders

+

{% trans "Purchase Orders" %}


- +
diff --git a/InvenTree/company/templates/company/detail_stock.html b/InvenTree/company/templates/company/detail_stock.html index 43966810b8..4acf783729 100644 --- a/InvenTree/company/templates/company/detail_stock.html +++ b/InvenTree/company/templates/company/detail_stock.html @@ -1,11 +1,12 @@ {% extends "company/company_base.html" %} {% load static %} +{% load i18n %} {% block details %} {% include "company/tabs.html" with tab='stock' %} -

Supplier Stock

+

{% trans "Supplier Stock" %}


@@ -29,7 +30,7 @@ $("#stock-export").click(function() { launchModalForm("{% url 'stock-export-options' %}", { - submit_text: "Export", + submit_text: '{% trans "Export" %}', success: function(response) { var url = "{% url 'stock-export' %}"; diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index 711ed8eb37..0c5e3a6931 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -1,19 +1,20 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block page_title %} -InvenTree | Supplier List +InvenTree | {% trans "Supplier List" %} {% endblock %} {% block content %} -

Supplier List

+

{% trans "Supplier List" %}


- +
@@ -37,12 +38,12 @@ InvenTree | Supplier List columns: [ { field: 'pk', - title: 'ID', + title: '{% trans "ID" %}', visible: false, }, { field: 'name', - title: 'Supplier', + title: '{% trans "Supplier" %}', sortable: true, formatter: function(value, row, index, field) { return imageHoverIcon(row.image) + renderLink(value, row.url); @@ -50,12 +51,12 @@ InvenTree | Supplier List }, { 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); @@ -65,7 +66,7 @@ InvenTree | Supplier List }, { field: 'part_count', - title: 'Parts', + title: '{% trans "Parts" %}', sortable: true, formatter: function(value, row, index, field) { return renderLink(value, row.url + 'parts/'); diff --git a/InvenTree/company/templates/company/order_detail.html b/InvenTree/company/templates/company/order_detail.html deleted file mode 100644 index 34c9071e38..0000000000 --- a/InvenTree/company/templates/company/order_detail.html +++ /dev/null @@ -1,49 +0,0 @@ -{% extends "base.html" %} - -{% block content %} - -

Supplier Order Details

- - - - - - - - - - - - - - - - - - - - - - - - - - -
Reference{{ order.internal_ref }}
Supplier - {% if order.supplier %} - {{ order.supplier.name }} - {% endif %} -
Status{% include "supplier/order_status.html" with order=order %}
Created Date{{ order.created_date }}
Issued Date{{ order.issued_date }}
Delivered Date{{ order.delivery_date }}
- - -{% if order.notes %} -
-
Notes
-
{{ order.notes }}
-
-{% endif %} - -

TODO

-Here we list all the line ites which exist under this order... - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/partdetail.html b/InvenTree/company/templates/company/partdetail.html index b6b12b114d..1b101ec48e 100644 --- a/InvenTree/company/templates/company/partdetail.html +++ b/InvenTree/company/templates/company/partdetail.html @@ -1,15 +1,16 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block page_title %} -InvenTree | {{ company.name }} - Parts +InvenTree | {{ company.name }} - {% trans "Parts" %} {% endblock %} {% block content %}
-

Supplier Part

+

{% trans "Supplier Part" %}