diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 3a91821a19..6cc4a9ed5f 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -29,6 +29,11 @@ class HelperForm(forms.ModelForm): self.helper.form_tag = False + # Check for errors from model validation + # If none, disable crispy form errors + if not self.errors: + self.helper.form_show_errors = False + """ Create a default 'layout' for this form. Ref: https://django-crispy-forms.readthedocs.io/en/latest/layouts.html diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 208220e23a..1c587d7b43 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -155,6 +155,8 @@ INSTALLED_APPS = [ 'markdownify', # Markdown template rendering 'django_tex', # LaTeX output 'django_admin_shell', # Python shell for the admin interface + 'error_report', # Error reporting in the admin interface + ] LOGGING = { @@ -181,6 +183,9 @@ MIDDLEWARE = CONFIG.get('middleware', [ 'InvenTree.middleware.AuthRequiredMiddleware' ]) +# Error reporting middleware +MIDDLEWARE.append('error_report.middleware.ExceptionProcessor') + AUTHENTICATION_BACKENDS = CONFIG.get('authentication_backends', [ 'django.contrib.auth.backends.ModelBackend' ]) diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 8006d633b5..ca2112d031 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -128,6 +128,7 @@ urlpatterns = [ url(r'^edit-user/', EditUserView.as_view(), name='edit-user'), url(r'^set-password/', SetPasswordView.as_view(), name='set-password'), + url(r'^admin/error_log/', include('error_report.urls')), url(r'^admin/shell/', include('django_admin_shell.urls')), url(r'^admin/', admin.site.urls, name='inventree-admin'), diff --git a/InvenTree/build/forms.py b/InvenTree/build/forms.py index 24f193865d..ba7787798d 100644 --- a/InvenTree/build/forms.py +++ b/InvenTree/build/forms.py @@ -66,7 +66,7 @@ class BuildOutputCreateForm(HelperForm): 'serial_numbers': 'fa-hashtag', } - quantity = forms.IntegerField( + output_quantity = forms.IntegerField( label=_('Quantity'), help_text=_('Enter quantity for build output'), ) @@ -86,7 +86,7 @@ class BuildOutputCreateForm(HelperForm): class Meta: model = Build fields = [ - 'quantity', + 'output_quantity', 'batch', 'serial_numbers', 'confirm', diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 6634b69cdf..a18328be1a 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -182,6 +182,14 @@ class Build(MPTTModel): blank=True, help_text=_('Extra build notes') ) + @property + def active(self): + """ + Return True if this build is active + """ + + return self.status in BuildStatus.ACTIVE_CODES + @property def bom_items(self): """ @@ -594,6 +602,9 @@ class Build(MPTTModel): - Mark the output as complete """ + # Select the location for the build output + location = kwargs.get('location', self.destination) + # List the allocated BuildItem objects for the given output allocated_items = output.items_to_install.all() @@ -613,6 +624,7 @@ class Build(MPTTModel): # Ensure that the output is updated correctly output.build = self output.is_building = False + output.location = location output.save() diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index e811c37ce8..aa45aa5054 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -21,6 +21,7 @@ InvenTree | Allocate Parts {% else %}