mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix part deletion template
- Display list of stock items which will be thusly deleted
This commit is contained in:
parent
b546b5e0cc
commit
a42371598c
@ -176,7 +176,7 @@ def ExtractSerialNumbers(serials, expected_quantity):
|
|||||||
else:
|
else:
|
||||||
numbers.append(n)
|
numbers.append(n)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Invalid group: {g}".format(g=group))
|
errors.append("Invalid group: {g}".format(g=group))
|
||||||
|
|
||||||
if len(errors) > 0:
|
if len(errors) > 0:
|
||||||
raise ValidationError(errors)
|
raise ValidationError(errors)
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if part.locations.all|length > 0 %}
|
{% if part.stock_items.all|length > 0 %}
|
||||||
<hr>
|
<hr>
|
||||||
<p>There are {{ part.locations.all|length }} stock entries defined for this part. If you delete this part, the following stock entries will also be deleted:
|
<p>There are {{ part.stock_items.all|length }} stock entries defined for this part. If you delete this part, the following stock entries will also be deleted:
|
||||||
<ul class='list-group'>
|
<ul class='list-group'>
|
||||||
{% for stock in part.locations.all %}
|
{% for stock in part.stock_items.all %}
|
||||||
<li class='list-group-item'>{{ stock.location.name }} - {{ stock.quantity }} items</li>
|
<li class='list-group-item'>{{ stock }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
@ -528,9 +528,14 @@ class StockItem(models.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = '{n} x {part}'.format(
|
if self.part.trackable and self.serial:
|
||||||
n=self.quantity,
|
s = '{part} #{sn}'.format(
|
||||||
part=self.part.full_name)
|
part=self.part.full_name,
|
||||||
|
sn=self.serial)
|
||||||
|
else:
|
||||||
|
s = '{n} x {part}'.format(
|
||||||
|
n=self.quantity,
|
||||||
|
part=self.part.full_name)
|
||||||
|
|
||||||
if self.location:
|
if self.location:
|
||||||
s += ' @ {loc}'.format(loc=self.location.name)
|
s += ' @ {loc}'.format(loc=self.location.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user