mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-18 12:56:31 -06:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c4362c42a | ||
|
|
5b6d999091 | ||
|
|
970714a76f | ||
|
|
59214cacbf | ||
|
|
4868194a0b | ||
|
|
53e442f555 | ||
|
|
9f6d860554 | ||
|
|
a1908f1bf1 | ||
|
|
c29e58aeaa | ||
|
|
fdaf6d3e19 | ||
|
|
78badcd65b |
@@ -13,7 +13,7 @@ import common.models
|
||||
from InvenTree.api_version import INVENTREE_API_VERSION
|
||||
|
||||
# InvenTree software version
|
||||
INVENTREE_SW_VERSION = "0.11.0"
|
||||
INVENTREE_SW_VERSION = "0.11.3"
|
||||
|
||||
|
||||
def inventreeInstanceName():
|
||||
|
||||
@@ -390,7 +390,7 @@
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% if roles.salse_order.add %}
|
||||
{% if roles.sales_order.add %}
|
||||
$("#new-sales-order").click(function() {
|
||||
|
||||
createSalesOrder({
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
{% endblock page_content %}
|
||||
|
||||
{% block js_ready %}
|
||||
{% settings_value "PURCHASEORDER_EDIT_COMPLETED_ORDERS" as allow_extra_editing %}
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
@@ -174,7 +175,7 @@
|
||||
filterkey: "postock"
|
||||
});
|
||||
|
||||
{% if order.status == PurchaseOrderStatus.PENDING %}
|
||||
{% if order.is_open or allow_extra_editing %}
|
||||
$('#new-po-line').click(function() {
|
||||
|
||||
createPurchaseOrderLineItem({{ order.pk }}, {
|
||||
|
||||
@@ -1293,6 +1293,11 @@ class Part(InvenTreeBarcodeMixin, MetadataMixin, MPTTModel):
|
||||
)
|
||||
|
||||
for item in queryset.all():
|
||||
|
||||
if item.quantity <= 0:
|
||||
# Ignore zero-quantity items
|
||||
continue
|
||||
|
||||
# Iterate through each item in the queryset, work out the limiting quantity
|
||||
quantity = item.available_stock + item.substitute_stock
|
||||
|
||||
|
||||
@@ -434,7 +434,8 @@ class StockFilter(rest_filters.FilterSet):
|
||||
"""
|
||||
if str2bool(value):
|
||||
# The 'quantity' field is greater than the calculated 'allocated' field
|
||||
return queryset.filter(Q(quantity__gt=F('allocated')))
|
||||
# Note that the item must also be "in stock"
|
||||
return queryset.filter(StockItem.IN_STOCK_FILTER).filter(Q(quantity__gt=F('allocated')))
|
||||
else:
|
||||
# The 'quantity' field is less than (or equal to) the calculated 'allocated' field
|
||||
return queryset.filter(Q(quantity__lte=F('allocated')))
|
||||
@@ -1188,7 +1189,12 @@ class StockTrackingList(ListAPI):
|
||||
"""List all stock tracking entries."""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
page = self.paginate_queryset(queryset)
|
||||
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
else:
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
|
||||
data = serializer.data
|
||||
|
||||
@@ -1262,6 +1268,8 @@ class StockTrackingList(ListAPI):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if page is not None:
|
||||
return self.get_paginated_response(data)
|
||||
if request.is_ajax():
|
||||
return JsonResponse(data, safe=False)
|
||||
else:
|
||||
|
||||
@@ -76,7 +76,11 @@ function formatPriceRange(price_min, price_max, options={}) {
|
||||
var p_min = price_min || price_max;
|
||||
var p_max = price_max || price_min;
|
||||
|
||||
var quantity = options.quantity || 1;
|
||||
var quantity = 1;
|
||||
|
||||
if ('quantity' in options) {
|
||||
quantity = options.quantity;
|
||||
}
|
||||
|
||||
if (p_min == null && p_max == null) {
|
||||
return null;
|
||||
|
||||
@@ -379,7 +379,7 @@ function completePendingShipments(order_id, options={}) {
|
||||
*/
|
||||
function completePendingShipmentsHelper(shipments, shipment_idx, options={}) {
|
||||
if (shipment_idx < shipments.length) {
|
||||
completeSalseOrderShipment(shipments[shipment_idx].pk,
|
||||
completeSalesOrderShipment(shipments[shipment_idx].pk,
|
||||
{
|
||||
buttons: [
|
||||
{
|
||||
@@ -1056,9 +1056,8 @@ function allocateStockToSalesOrder(order_id, line_items, options={}) {
|
||||
var table_entries = '';
|
||||
|
||||
for (var idx = 0; idx < line_items.length; idx++ ) {
|
||||
var line_item = line_items[idx];
|
||||
|
||||
var remaining = 0;
|
||||
let line_item = line_items[idx];
|
||||
let remaining = Math.max(0, line_item.quantity - line_item.allocated);
|
||||
|
||||
table_entries += renderLineItemRow(line_item, remaining);
|
||||
}
|
||||
@@ -1225,7 +1224,7 @@ function allocateStockToSalesOrder(order_id, line_items, options={}) {
|
||||
var available = Math.max((data.quantity || 0) - (data.allocated || 0), 0);
|
||||
|
||||
// Remaining quantity to be allocated?
|
||||
var remaining = Math.max(line_item.quantity - line_item.shipped - line_item.allocated, 0);
|
||||
var remaining = Math.max(line_item.quantity - line_item.allocated, 0);
|
||||
|
||||
// Maximum amount that we need
|
||||
var desired = Math.min(available, remaining);
|
||||
@@ -1892,7 +1891,7 @@ function loadSalesOrderLineItemTable(table, options={}) {
|
||||
if (row.part && row.part_detail) {
|
||||
let part = row.part_detail;
|
||||
|
||||
if (options.allow_edit && !row.shipped) {
|
||||
if (options.allow_edit && (row.shipped < row.quantity)) {
|
||||
if (part.trackable) {
|
||||
buttons += makeIconButton('fa-hashtag icon-green', 'button-add-by-sn', pk, '{% trans "Allocate serial numbers" %}');
|
||||
}
|
||||
|
||||
@@ -2063,6 +2063,10 @@ function loadStockTable(table, options) {
|
||||
currency = baseCurrency();
|
||||
}
|
||||
|
||||
if (row.quantity <= 0) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return formatPriceRange(
|
||||
min_price,
|
||||
max_price,
|
||||
|
||||
Reference in New Issue
Block a user