mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Fix "in_stock" logic for StockItem
- Not in stock if it is at a customer!
This commit is contained in:
parent
861a2982db
commit
ff71fe6e93
@ -140,6 +140,7 @@ class StockItem(MPTTModel):
|
|||||||
sales_order=None,
|
sales_order=None,
|
||||||
build_order=None,
|
build_order=None,
|
||||||
belongs_to=None,
|
belongs_to=None,
|
||||||
|
customer=None,
|
||||||
status__in=StockStatus.AVAILABLE_CODES
|
status__in=StockStatus.AVAILABLE_CODES
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -609,6 +610,10 @@ class StockItem(MPTTModel):
|
|||||||
if self.build_order is not None:
|
if self.build_order is not None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Not 'in stock' if it has been assigned to a customer
|
||||||
|
if self.customer is not None:
|
||||||
|
return False
|
||||||
|
|
||||||
# Not 'in stock' if the status code makes it unavailable
|
# Not 'in stock' if the status code makes it unavailable
|
||||||
if self.status in StockStatus.UNAVAILABLE_CODES:
|
if self.status in StockStatus.UNAVAILABLE_CODES:
|
||||||
return False
|
return False
|
||||||
|
@ -97,16 +97,15 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
|||||||
<li><a href='#' id='stock-remove' title='{% trans "Remove stock" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li>
|
<li><a href='#' id='stock-remove' title='{% trans "Remove stock" %}'><span class='fas fa-minus-circle icon-red'></span> {% trans "Remove stock" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
|
<li><a href='#' id='stock-move' title='{% trans "Transfer stock" %}'><span class='fas fa-exchange-alt icon-blue'></span> {% trans "Transfer stock" %}</a></li>
|
||||||
{% endif %}
|
|
||||||
{% if item.part.trackable and not item.serialized %}
|
{% if item.part.trackable and not item.serialized %}
|
||||||
<li><a href='#' id='stock-serialize' title='{% trans "Serialize stock" %}'><span class='fas fa-hashtag'></span> {% trans "Serialize stock" %}</a> </li>
|
<li><a href='#' id='stock-serialize' title='{% trans "Serialize stock" %}'><span class='fas fa-hashtag'></span> {% trans "Serialize stock" %}</a> </li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.part.salable %}
|
{% endif %}
|
||||||
{% if item.customer %}
|
{% if item.part.salable and not item.customer %}
|
||||||
<li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li><a href='#' id='stock-assign-to-customer' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li>
|
<li><a href='#' id='stock-assign-to-customer' title='{% trans "Assign to customer" %}'><span class='fas fa-user-tie'></span> {% trans "Assign to customer" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if item.customer %}
|
||||||
|
<li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user