mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-20 13:56:30 +00:00
More work
- Consolidated "in_stock" filter to single code location - Improve 'limit_choices_to' for BuildItem and SalesOrderAllocation - Various template improvements etc
This commit is contained in:
@ -42,6 +42,7 @@ from InvenTree.helpers import decimal2string, normalize
|
||||
from InvenTree.status_codes import BuildStatus, StockStatus, PurchaseOrderStatus
|
||||
|
||||
from company.models import SupplierPart
|
||||
from stock import models as StockModels
|
||||
|
||||
|
||||
class PartCategory(InvenTreeTree):
|
||||
@ -639,11 +640,12 @@ class Part(models.Model):
|
||||
def stock_entries(self):
|
||||
""" Return all 'in stock' items. To be in stock:
|
||||
|
||||
- customer is None
|
||||
- build_order is None
|
||||
- sales_order is None
|
||||
- belongs_to is None
|
||||
"""
|
||||
|
||||
return self.stock_items.filter(customer=None, belongs_to=None)
|
||||
return self.stock_items.filter(StockModels.StockItem.IN_STOCK_FILTER).exclude(status__in=StockStatus.UNAVAILABLE_CODES)
|
||||
|
||||
@property
|
||||
def total_stock(self):
|
||||
|
@ -6,11 +6,6 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if part.active == False %}
|
||||
<div class='alert alert-danger alert-block'>
|
||||
{% trans "This part is not active" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if part.is_template %}
|
||||
<div class='alert alert-info alert-block'>
|
||||
{% trans "This part is a template part." %}
|
||||
@ -28,9 +23,14 @@
|
||||
<div class="col-sm-6">
|
||||
{% include "part/part_thumb.html" %}
|
||||
<div class="media-body">
|
||||
<h4>
|
||||
<h3>
|
||||
{{ part.full_name }}
|
||||
</h4>
|
||||
{% if not part.active %}
|
||||
<div class='label label-large label-large-red'>
|
||||
{% trans 'Inactive' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<p><i>{{ part.description }}</i></p>
|
||||
<p>
|
||||
<div class='btn-row'>
|
||||
|
Reference in New Issue
Block a user