mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-14 19:15:41 +00:00
Style fixes
This commit is contained in:
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
from crispy_forms.helper import FormHelper
|
||||
from crispy_forms.layout import Submit
|
||||
|
||||
from .models import StockLocation, StockItem
|
||||
|
||||
|
@ -59,24 +59,20 @@ class StockItem(models.Model):
|
||||
|
||||
def clean(self):
|
||||
|
||||
|
||||
# The 'supplier_part' field must point to the same part!
|
||||
try:
|
||||
if self.supplier_part is not None:
|
||||
if not self.supplier_part.part == self.part:
|
||||
raise ValidationError({
|
||||
'supplier_part': _(
|
||||
"Part type ('{pf}') must be {pe}").format(
|
||||
pf=str(self.supplier_part.part),
|
||||
pe=str(self.part)
|
||||
)
|
||||
})
|
||||
raise ValidationError({'supplier_part': _("Part type ('{pf}') must be {pe}").format(
|
||||
pf=str(self.supplier_part.part),
|
||||
pe=str(self.part))
|
||||
})
|
||||
|
||||
except Part.DoesNotExist:
|
||||
# This gets thrown if self.supplier_part is null
|
||||
# TODO - Find a test than can be perfomed...
|
||||
pass
|
||||
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/stock/item/{id}/'.format(id=self.id)
|
||||
|
||||
@ -205,7 +201,7 @@ class StockItem(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
s = '{n} x {part}'.format(
|
||||
n=self.quantity,
|
||||
n=self.quantity,
|
||||
part=self.part.name)
|
||||
|
||||
if self.location:
|
||||
|
@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
from django.views.generic import DetailView, ListView
|
||||
from django.views.generic.edit import UpdateView, DeleteView, CreateView
|
||||
|
||||
from InvenTree.views import AjaxUpdateView, AjaxDeleteView, AjaxCreateView
|
||||
|
||||
|
Reference in New Issue
Block a user