diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 2f54a50219..579803410b 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -1,3 +1,11 @@ +:root { + --primary-color: #335d88; + --secondary-color: #b69c80; + --highlight-color: #f5efe8; + --basic-color: #333; +} + + .qr-code { max-width: 400px; max-height: 400px; @@ -98,11 +106,11 @@ max-width: 250px; } -.bomrowvalid { +.rowvalid { color: #050; } -.bomrowinvalid { +.rowinvalid { color: #A00; font-style: italic; } diff --git a/InvenTree/InvenTree/static/script/inventree/bom.js b/InvenTree/InvenTree/static/script/inventree/bom.js index aa64a776f5..97dca94017 100644 --- a/InvenTree/InvenTree/static/script/inventree/bom.js +++ b/InvenTree/InvenTree/static/script/inventree/bom.js @@ -280,9 +280,9 @@ function loadBomTable(table, options) { search: true, rowStyle: function(row, index) { if (row.validated) { - return {classes: 'bomrowvalid'}; + return {classes: 'rowvalid'}; } else { - return {classes: 'bomrowinvalid'}; + return {classes: 'rowinvalid'}; } }, formatNoMatches: function() { return "No BOM items found"; }, diff --git a/InvenTree/build/templates/build/allocate_view.html b/InvenTree/build/templates/build/allocate_view.html index c688171f7e..f5f3952546 100644 --- a/InvenTree/build/templates/build/allocate_view.html +++ b/InvenTree/build/templates/build/allocate_view.html @@ -21,7 +21,7 @@ {% for item in build.required_parts %} - + {% include "hover_image.html" with image=item.part.image hover=True %} {{ item.part.full_name }} diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index 3e4ee98cd5..3ab3fc05c0 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -34,7 +34,7 @@ InvenTree | Build - {{ build }} - {% endif %} diff --git a/InvenTree/company/admin.py b/InvenTree/company/admin.py index ce023aedc0..f69bfec54f 100644 --- a/InvenTree/company/admin.py +++ b/InvenTree/company/admin.py @@ -38,8 +38,12 @@ class SupplierPartResource(ModelResource): part = Field(attribute='part', widget=widgets.ForeignKeyWidget(Part)) + part_name = Field(attribute='part__full_name', readonly=True) + supplier = Field(attribute='supplier', widget=widgets.ForeignKeyWidget(Company)) + supplier_name = Field(attribute='supplier__name', readonly=True) + class Meta: model = SupplierPart skip_unchanged = True @@ -61,6 +65,16 @@ class SupplierPriceBreakResource(ModelResource): currency = Field(attribute='currency', widget=widgets.ForeignKeyWidget(Currency)) + supplier_id = Field(attribute='part__supplier__pk', readonly=True) + + supplier_name = Field(attribute='part__supplier__name', readonly=True) + + part_name = Field(attribute='part__part__full_name', readonly=True) + + SKU = Field(attribute='part__SKU', readonly=True) + + MPN = Field(attribute='part__MPN', readonly=True) + class Meta: model = SupplierPriceBreak skip_unchanged = True diff --git a/InvenTree/company/templates/company/partdetail.html b/InvenTree/company/templates/company/partdetail.html index c3dd3a50d6..77d71ea77c 100644 --- a/InvenTree/company/templates/company/partdetail.html +++ b/InvenTree/company/templates/company/partdetail.html @@ -93,8 +93,8 @@ InvenTree | {{ company.name }} - Parts {{ pb.cost }} {% if pb.currency %}{{ pb.currency.suffix }}{% endif %}
- - + +
diff --git a/InvenTree/order/templates/order/po_table.html b/InvenTree/order/templates/order/po_table.html index 32b5d4e80c..16fa462951 100644 --- a/InvenTree/order/templates/order/po_table.html +++ b/InvenTree/order/templates/order/po_table.html @@ -1,11 +1,11 @@ - - - - - + + + + + diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 88ff2f2599..971373ed9b 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -7,6 +7,7 @@ from __future__ import unicode_literals from InvenTree.forms import HelperForm +from mptt.fields import TreeNodeChoiceField from django import forms from django.utils.translation import ugettext as _ @@ -66,6 +67,12 @@ class EditPartAttachmentForm(HelperForm): ] +class SetPartCategoryForm(forms.Form): + """ Form for setting the category of multiple Part objects """ + + part_category = TreeNodeChoiceField(queryset=PartCategory.objects.all(), required=True, help_text=_('Select part category')) + + class EditPartForm(HelperForm): """ Form for editing a Part object """ diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 26098be946..d9913482fd 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -49,6 +49,7 @@
CompanyOrder ReferenceDescriptionStatusItemsCompanyOrder ReferenceDescriptionStatusItems
- {% for part in parts %} - - - - - - - - {% endfor %} -
Part Description Category -
- {% include "hover_image.html" with image=part.image hover=False %} - {{ part.full_name }} - - {{ part.description }} - - {{ part.category.pathstring }} - - -
- - -{% endblock %} \ No newline at end of file + + {% for part in parts %} + + + + {% include "hover_image.html" with image=part.image hover=False %} + {{ part.full_name }} + + + {{ part.description }} + + + {{ part.category.pathstring }} + + + + + + {% endfor %} + + + {% crispy form %} + + + {% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index c51d07fdd5..14a884c2b7 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -46,6 +46,12 @@ def inventree_commit(*args, **kwargs): @register.simple_tag() -def inventree_github(*args, **kwargs): +def inventree_github_url(*args, **kwargs): """ Return URL for InvenTree github site """ return "https://github.com/InvenTree" + + +@register.simple_tag() +def inventree_docs_url(*args, **kwargs): + """ Return URL for InvenTree documenation site """ + return "https://inventree.github.io" diff --git a/InvenTree/part/test_part.py b/InvenTree/part/test_part.py index 84d9900aff..46eb484b12 100644 --- a/InvenTree/part/test_part.py +++ b/InvenTree/part/test_part.py @@ -26,7 +26,10 @@ class TemplateTagTest(TestCase): self.assertEqual(len(hash), 7) def test_github(self): - self.assertIn('github.com', inventree_extras.inventree_github()) + self.assertIn('github.com', inventree_extras.inventree_github_url()) + + def test_docs(self): + self.assertIn('inventree.github.io', inventree_extras.inventree_docs_url()) class PartTest(TestCase): diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 7d1a3ab633..a736b9275e 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -6,6 +6,7 @@ Django views for interacting with Part app from __future__ import unicode_literals from django.core.exceptions import ValidationError +from django.db import transaction from django.shortcuts import get_object_or_404 from django.shortcuts import HttpResponseRedirect from django.utils.translation import gettext_lazy as _ @@ -138,11 +139,12 @@ class PartAttachmentDelete(AjaxDeleteView): } -class PartSetCategory(AjaxView): +class PartSetCategory(AjaxUpdateView): """ View for settings the part category for multiple parts at once """ ajax_template_name = 'part/set_category.html' ajax_form_title = 'Set Part Category' + form_class = part_forms.SetPartCategoryForm category = None parts = [] @@ -157,7 +159,7 @@ class PartSetCategory(AjaxView): else: self.parts = [] - return self.renderJsonResponse(request, context=self.get_context_data()) + return self.renderJsonResponse(request, form=self.get_form(), context=self.get_context_data()) def post(self, request, *args, **kwargs): """ Respond to a POST request to this view """ @@ -193,10 +195,14 @@ class PartSetCategory(AjaxView): } if valid: - for part in self.parts: - part.set_category(self.category) + self.set_category() - return self.renderJsonResponse(request, data=data, context=self.get_context_data()) + return self.renderJsonResponse(request, data=data, form=self.get_form(), context=self.get_context_data()) + + @transaction.atomic + def set_category(self): + for part in self.parts: + part.set_category(self.category) def get_context_data(self): """ Return context data for rendering in the form """ diff --git a/InvenTree/templates/about.html b/InvenTree/templates/about.html index aef286f6cf..7e2abeb788 100644 --- a/InvenTree/templates/about.html +++ b/InvenTree/templates/about.html @@ -26,7 +26,11 @@ - View Code on GitHub{% inventree_github %} + InvenTree Documenation + {% inventree_docs_url %} + + + View Code on GitHub{% inventree_github_url %}