2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-20 13:56:30 +00:00

PEP fixes

This commit is contained in:
Oliver Walters
2020-05-16 17:52:25 +10:00
parent a6ad263ee7
commit 8a99062704
6 changed files with 26 additions and 44 deletions

View File

@ -308,6 +308,24 @@ class Part(MPTTModel):
else:
return n + 1
def getSerialNumberString(self, quantity):
"""
Return a formatted string representing the next available serial numbers,
given a certain quantity of items.
"""
sn = self.getNextSerialNumber()
if quantity >= 2:
sn = "{n}-{m}".format(
n=sn,
m=int(sn + quantity - 1)
)
else:
sn = str(sn)
return sn
@property
def full_name(self):
""" Format a 'full name' for this Part.