mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Check for null StockItem location
This commit is contained in:
parent
5162c1d11f
commit
28e6d50f08
@ -181,10 +181,14 @@ class StockItem(models.Model):
|
|||||||
self.add_stock(-amount)
|
self.add_stock(-amount)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{n} x {part} @ {loc}".format(
|
s = '{n} x {part}'.format(
|
||||||
n=self.quantity,
|
n=self.quantity,
|
||||||
part=self.part.name,
|
part=self.part.name)
|
||||||
loc=self.location.name)
|
|
||||||
|
if self.location:
|
||||||
|
s += ' @ {loc}'.format(loc=self.location.name)
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_trackable(self):
|
def is_trackable(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user