mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Allow adjustment for destroyed (or lost) stock
This commit is contained in:
parent
ca16e4f35d
commit
ea4b713eed
@ -832,6 +832,27 @@ class StockItem(MPTTModel):
|
|||||||
|
|
||||||
return query.exists()
|
return query.exists()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def can_adjust_location(self):
|
||||||
|
"""
|
||||||
|
Returns True if the stock location can be "adjusted" for this part
|
||||||
|
|
||||||
|
Cannot be adjusted if:
|
||||||
|
- Has been delivered to a customer
|
||||||
|
- Has been installed inside another StockItem
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self.customer is not None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.belongs_to is not None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.sales_order is not None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tracking_info_count(self):
|
def tracking_info_count(self):
|
||||||
return self.tracking_info.count()
|
return self.tracking_info.count()
|
||||||
|
@ -155,7 +155,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
|||||||
<div class='btn-group'>
|
<div class='btn-group'>
|
||||||
<button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
|
<button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
|
||||||
<ul class='dropdown-menu' role='menu'>
|
<ul class='dropdown-menu' role='menu'>
|
||||||
{% if item.in_stock %}
|
{% if item.can_adjust_location %}
|
||||||
{% if not item.serialized %}
|
{% if not item.serialized %}
|
||||||
<li><a href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-clipboard-list'></span> {% trans "Count stock" %}</a></li>
|
<li><a href='#' id='stock-count' title='{% trans "Count stock" %}'><span class='fas fa-clipboard-list'></span> {% trans "Count stock" %}</a></li>
|
||||||
<li><a href='#' id='stock-add' title='{% trans "Add stock" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li>
|
<li><a href='#' id='stock-add' title='{% trans "Add stock" %}'><span class='fas fa-plus-circle icon-green'></span> {% trans "Add stock" %}</a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user