mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 19:20:55 +00:00
Merge branch 'master' into stock-item-forms
# Conflicts: # InvenTree/stock/serializers.py # InvenTree/stock/templates/stock/item_base.html
This commit is contained in:
@ -7,17 +7,14 @@ from __future__ import unicode_literals
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from django.urls import reverse
|
||||
from django.http import JsonResponse
|
||||
from django.db.models import Q
|
||||
|
||||
from rest_framework import status
|
||||
from rest_framework.serializers import ValidationError
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import generics, filters, permissions
|
||||
from rest_framework import generics, filters
|
||||
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from django_filters import rest_framework as rest_filters
|
||||
@ -42,28 +39,11 @@ import common.models
|
||||
|
||||
import stock.serializers as StockSerializers
|
||||
|
||||
from InvenTree.views import TreeSerializer
|
||||
from InvenTree.helpers import str2bool, isNull
|
||||
from InvenTree.api import AttachmentMixin
|
||||
from InvenTree.filters import InvenTreeOrderingFilter
|
||||
|
||||
|
||||
class StockCategoryTree(TreeSerializer):
|
||||
title = _('Stock')
|
||||
model = StockLocation
|
||||
|
||||
@property
|
||||
def root_url(self):
|
||||
return reverse('stock-index')
|
||||
|
||||
def get_items(self):
|
||||
return StockLocation.objects.all().prefetch_related('stock_items', 'children')
|
||||
|
||||
permission_classes = [
|
||||
permissions.IsAuthenticated,
|
||||
]
|
||||
|
||||
|
||||
class StockDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
""" API detail endpoint for Stock object
|
||||
|
||||
@ -1105,8 +1085,6 @@ stock_api_urls = [
|
||||
url(r'^.*$', StockTrackingList.as_view(), name='api-stock-tracking-list'),
|
||||
])),
|
||||
|
||||
url(r'^tree/', StockCategoryTree.as_view(), name='api-stock-tree'),
|
||||
|
||||
# Detail for a single stock item
|
||||
url(r'^(?P<pk>\d+)/', StockDetail.as_view(), name='api-stock-detail'),
|
||||
|
||||
|
@ -6,39 +6,44 @@
|
||||
{% load l10n %}
|
||||
{% load markdownify %}
|
||||
|
||||
{% block menubar %}
|
||||
{% include "stock/navbar.html" %}
|
||||
{% block sidebar %}
|
||||
{% include "stock/stock_sidebar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-history'>
|
||||
<div class='panel panel-hidden' id='panel-history'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Stock Tracking Information" %}</h4>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
{% if owner_control.value == "True" %}
|
||||
{% authorized_owners item.owner as owners %}
|
||||
{% endif %}
|
||||
<!-- Check permissions and owner -->
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners %}
|
||||
{% if roles.stock.change and not item.is_building %}
|
||||
<div id='table-toolbar'>
|
||||
<div class='btn-group'>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Stock Tracking Information" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
{% if owner_control.value == "True" %}
|
||||
{% authorized_owners item.owner as owners %}
|
||||
{% endif %}
|
||||
<!-- Check permissions and owner -->
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners %}
|
||||
{% if roles.stock.change and not item.is_building %}
|
||||
<button class='btn btn-success' type='button' title='New tracking entry' id='new-entry'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "New Entry" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='table-toolbar'>
|
||||
<div class='btn-group'>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<table class='table table-condensed table-striped' id='track-table' data-toolbar='#table-toolbar'>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-children'>
|
||||
<div class='panel panel-hidden' id='panel-children'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Child Stock Items" %}</h4>
|
||||
</div>
|
||||
@ -53,29 +58,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-test-data'>
|
||||
<div class='panel panel-hidden' id='panel-test-data'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Test Data" %}</h4>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Test Data" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button type='button' class='btn btn-outline-secondary' id='test-report'>
|
||||
<span class='fas fa-file-pdf'></span> {% trans "Test Report" %}
|
||||
</button>
|
||||
{% if user.is_staff %}
|
||||
<button type='button' class='btn btn-danger' id='delete-test-results'>
|
||||
<span class='fas fa-trash-alt'></span> {% trans "Delete Test Data" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
<button type='button' class='btn btn-success' id='add-test-result'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Add Test Data" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='test-button-toolbar'>
|
||||
<div class='button-toolbar container-fluid' style="float: right;">
|
||||
<div class='btn-group' role='group'>
|
||||
{% if user.is_staff %}
|
||||
<button type='button' class='btn btn-danger' id='delete-test-results'>
|
||||
<span class='fas fa-trash-alt'></span> {% trans "Delete Test Data" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
<button type='button' class='btn btn-success' id='add-test-result'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Add Test Data" %}
|
||||
</button>
|
||||
<button type='button' class='btn btn-default' id='test-report'>
|
||||
<span class='fas fa-tasks'></span> {% trans "Test Report" %}
|
||||
</button>
|
||||
</div>
|
||||
<div class='filter-list' id='filter-list-stocktests'>
|
||||
<!-- Empty div -->
|
||||
</div>
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "filter_list.html" with id="stocktests" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -83,16 +89,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-attachments'>
|
||||
<div class='panel panel-hidden' id='panel-attachments'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Attachments" %}</h4>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Attachments" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
{% include "attachment_button.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% include "attachment_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-notes'>
|
||||
<div class='panel panel-hidden' id='panel-notes'>
|
||||
<div class='panel-heading'>
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
@ -100,7 +112,7 @@
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
<div class='btn-group float-right'>
|
||||
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'>
|
||||
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-outline-secondary'>
|
||||
<span class='fas fa-edit'>
|
||||
</span>
|
||||
</button>
|
||||
@ -115,15 +127,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-installed-items'>
|
||||
<div class='panel panel-hidden' id='panel-installed-items'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Installed Stock Items" %}</h4>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Installed Stock Items" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button type='button' class='btn btn-success' id='stock-item-install'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Install Stock Item" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div class='btn-group'>
|
||||
<button type='button' class='btn btn-success' id='stock-item-install'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Install Stock Item" %}
|
||||
</button>
|
||||
</div>
|
||||
<table class='table table-striped table-condensed' id='installed-table'></table>
|
||||
</div>
|
||||
@ -397,4 +414,6 @@
|
||||
url: "{% url 'api-stock-tracking-list' %}",
|
||||
});
|
||||
|
||||
enableSidebar('stockitem');
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "two_column.html" %}
|
||||
{% extends "page_base.html" %}
|
||||
{% load static %}
|
||||
{% load inventree_extras %}
|
||||
{% load status_codes %}
|
||||
@ -8,58 +8,19 @@
|
||||
{% inventree_title %} | {% trans "Stock Item" %} - {{ item }}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidenav %}
|
||||
<div id='stock-tree'></div>
|
||||
{% endblock %}
|
||||
|
||||
{% block pre_content %}
|
||||
{% block breadcrumbs %}
|
||||
{% include 'stock/loc_link.html' with location=item.location %}
|
||||
{% endblock %}
|
||||
|
||||
{% block thumbnail %}
|
||||
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
|
||||
{% block heading %}
|
||||
{% trans "Stock Item" %}: {{ item.part.full_name}}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_data %}
|
||||
{% block actions %}
|
||||
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
{% if owner_control.value == "True" %}
|
||||
{% authorized_owners item.owner as owners %}
|
||||
{% endif %}
|
||||
|
||||
<h3>
|
||||
{% trans "Stock Item" %}
|
||||
{% if item.is_expired %}
|
||||
<span class='label label-large label-large-red'>{% trans "Expired" %}</span>
|
||||
{% else %}
|
||||
{% if roles.stock.change %}
|
||||
<a href='#' id='stock-edit-status'>
|
||||
{% endif %}
|
||||
{% stock_status_label item.status large=True %}
|
||||
{% if roles.stock.change %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if item.is_stale %}
|
||||
<span class='label label-large label-large-yellow'>{% trans "Stale" %}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</h3>
|
||||
<hr>
|
||||
<h4>
|
||||
{% if roles.part.view %}
|
||||
<a href='{% url "part-detail" item.part.pk %}'>
|
||||
{% endif %}
|
||||
{{ item.part.full_name}}
|
||||
{% if roles.part.view %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if item.serialized %}
|
||||
# {{ item.serial }}
|
||||
{% else %}
|
||||
× {% decimal item.quantity %}
|
||||
{% endif %}
|
||||
{% if user.is_staff and roles.stock.change %}
|
||||
<a href="{% url 'admin:stock_stockitem_change' item.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
|
||||
{% url 'admin:stock_stockitem_change' item.pk as url %}
|
||||
{% include "admin_button.html" with url=url %}
|
||||
{% endif %}
|
||||
</h4>
|
||||
|
||||
@ -162,9 +123,36 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% block thumbnail %}
|
||||
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
|
||||
{% endblock %}
|
||||
|
||||
{% block below_thumbnail %}
|
||||
{% block details %}
|
||||
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
{% if owner_control.value == "True" %}
|
||||
{% authorized_owners item.owner as owners %}
|
||||
{% endif %}
|
||||
|
||||
<h4>
|
||||
{% if item.is_expired %}
|
||||
<span class='badge rounded-pill bg-danger'>{% trans "Expired" %}</span>
|
||||
{% else %}
|
||||
{% if roles.stock.change %}
|
||||
<a href='#' id='stock-edit-status'>
|
||||
{% endif %}
|
||||
{% stock_status_label item.status large=True %}
|
||||
{% if roles.stock.change %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if item.is_stale %}
|
||||
<span class='badge rounded-pill bg-warning'>{% trans "Stale" %}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</h4>
|
||||
|
||||
|
||||
|
||||
<div class='info-messages'>
|
||||
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
@ -231,8 +219,7 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_details %}
|
||||
<h4>{% trans "Stock Item Details" %}</h4>
|
||||
{% block details_right %}
|
||||
<table class="table table-striped">
|
||||
<col width='25'>
|
||||
<tr>
|
||||
@ -254,13 +241,13 @@
|
||||
<td>{% trans "Serial Number" %}</td>
|
||||
<td>
|
||||
{% if previous %}
|
||||
<a class="btn btn-default" aria-label="{% trans 'previous page' %}" href="{% url request.resolver_match.url_name previous.id %}">
|
||||
<a class="btn btn-outline-secondary" aria-label="{% trans 'previous page' %}" href="{% url request.resolver_match.url_name previous.id %}">
|
||||
<small>{{ previous.serial }}</small> ‹
|
||||
</a>
|
||||
{% endif %}
|
||||
{{ item.serial }}
|
||||
{% if next %}
|
||||
<a class="btn btn-default text-sm" aria-label="{% trans 'next page' %}" href="{% url request.resolver_match.url_name next.id %}">
|
||||
<a class="btn btn-outline-secondary text-sm" aria-label="{% trans 'next page' %}" href="{% url request.resolver_match.url_name next.id %}">
|
||||
› <small>{{ next.serial }}</small>
|
||||
</a>
|
||||
{% endif %}
|
||||
@ -399,9 +386,9 @@
|
||||
<td>
|
||||
{{ item.expiry_date }}
|
||||
{% if item.is_expired %}
|
||||
<span title='{% blocktrans %}This StockItem expired on {{ item.expiry_date }}{% endblocktrans %}' class='label label-red'>{% trans "Expired" %}</span>
|
||||
<span title='{% blocktrans %}This StockItem expired on {{ item.expiry_date }}{% endblocktrans %}' class='badge rounded-pill bg-danger'>{% trans "Expired" %}</span>
|
||||
{% elif item.is_stale %}
|
||||
<span title='{% blocktrans %}This StockItem expires on {{ item.expiry_date }}{% endblocktrans %}' class='label label-yellow'>{% trans "Stale" %}</span>
|
||||
<span title='{% blocktrans %}This StockItem expires on {{ item.expiry_date }}{% endblocktrans %}' class='badge rounded-pill bg-warning'>{% trans "Stale" %}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@ -433,30 +420,12 @@
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
enableNavbar({
|
||||
label: 'item',
|
||||
toggleId: '#item-menu-toggle',
|
||||
});
|
||||
|
||||
loadTree("{% url 'api-stock-tree' %}",
|
||||
"#stock-tree",
|
||||
{
|
||||
name: 'stock',
|
||||
}
|
||||
);
|
||||
|
||||
initNavTree({
|
||||
label: 'stock',
|
||||
treeId: '#sidenav-left',
|
||||
toggleId: '#toggle-stock-tree',
|
||||
});
|
||||
|
||||
$("#stock-serialize").click(function() {
|
||||
launchModalForm(
|
||||
"{% url 'stock-item-serialize' item.id %}",
|
||||
@ -634,9 +603,4 @@ $("#stock-return-from-customer").click(function() {
|
||||
|
||||
{% endif %}
|
||||
|
||||
attachNavCallbacks({
|
||||
name: 'stockitem',
|
||||
default: 'history'
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,16 +1,9 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div class="navigation">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href='#' title='Toggle Stock Tree' id='toggle-stock-tree'><strong><span class='fas fa-stream'></span></strong></a></li>
|
||||
<li class="breadcrumb-item{% if location is None %} active" aria-current="page{% endif %}"><a href="/stock/">{% trans "Stock" %}</a></li>
|
||||
<li class="breadcrumb-item{% if location is None %} active" aria-current="page{% endif %}"><a href="/stock/">{% trans "Stock" %}</a></li>
|
||||
{% if location %}
|
||||
{% for path_item in location.parentpath %}
|
||||
<li class='breadcrumb-item'><a href="{% url 'stock-location-detail' path_item.id %}">{{ path_item.name }}</a></li>
|
||||
<li class='breadcrumb-item'><a href="{% url 'stock-location-detail' path_item.id %}">{{ path_item.name }}</a></li>
|
||||
{% endfor %}
|
||||
<li class='breadcrumb-item active' aria-current='page'><a href="{% url 'stock-location-detail' location.id %}">{{ location.name }}</a></li>
|
||||
<li class='breadcrumb-item active' aria-current='page'><a href="{% url 'stock-location-detail' location.id %}">{{ location.name }}</a></li>
|
||||
{% endif %}
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
@ -3,13 +3,88 @@
|
||||
{% load inventree_extras %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block menubar %}
|
||||
{% include "stock/location_navbar.html" %}
|
||||
{% block sidebar %}
|
||||
{% include "stock/location_sidebar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% block heading %}
|
||||
{% if location %}
|
||||
{% trans "Stock Location" %}: {{ location.name }}
|
||||
{% else %}
|
||||
{% trans "Stock" %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<div class='panel panel-default panel-inventree'>
|
||||
{% block actions %}
|
||||
<!-- Admin view -->
|
||||
{% if location and user.is_staff and roles.stock_location.change %}
|
||||
{% url 'admin:stock_stocklocation_change' location.pk as url %}
|
||||
{% include "admin_button.html" with url=url %}
|
||||
{% endif %}
|
||||
|
||||
{% if barcodes %}
|
||||
<!-- Barcode actions menu -->
|
||||
{% if location %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
|
||||
<ul class='dropdown-menu'>
|
||||
<li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Check permissions and owner -->
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %}
|
||||
{% if roles.stock.change %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'>
|
||||
<span class='fas fa-boxes'></span> <span class='caret'></span>
|
||||
</button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<li>
|
||||
<a class='dropdown-item' href='#' id='location-count'>
|
||||
<span class='fas fa-clipboard-list'></span>
|
||||
{% trans "Count stock" %}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class='dropdown-item' href='#' id='location-move'>
|
||||
<span class='fas fa-exchange-alt'></span>
|
||||
{% trans "Transfer stock" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if roles.stock_location.change %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<li><a class='dropdown-item' href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
|
||||
{% if roles.stock.delete %}
|
||||
<li><a class='dropdown-item' href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %}
|
||||
{% if roles.stock_location.add %}
|
||||
<button class='btn btn-success' id='location-create' type='button' title='{% trans "Create new stock location" %}'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "New Location" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block details_left %}
|
||||
{% if location %}
|
||||
<p>{{ location.description }}</p>
|
||||
{% else %}
|
||||
<p>{% trans "Top level stock location" %}</p>
|
||||
{% endif %}
|
||||
|
||||
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
|
||||
{% if owner_control.value == "True" %}
|
||||
@ -22,153 +97,73 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
{% if location %}
|
||||
<h3>
|
||||
{{ location.name }}
|
||||
{% if user.is_staff and roles.stock_location.change %}
|
||||
<a href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
<p>{{ location.description }}</p>
|
||||
{% else %}
|
||||
<h3>{% trans "Stock" %}</h3>
|
||||
<p>{% trans "All stock items" %}</p>
|
||||
{% endif %}
|
||||
<div class='btn-group action-buttons' role='group'>
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %}
|
||||
{% if roles.stock_location.add %}
|
||||
<button class='btn btn-default' id='location-create' title='{% trans "Create new stock location" %}'>
|
||||
<span class='fas fa-plus-circle icon-green'/>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if barcodes %}
|
||||
<!-- Barcode actions menu -->
|
||||
{% if location %}
|
||||
<div class='btn-group'>
|
||||
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<li><a href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
|
||||
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
|
||||
<li><a href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Check permissions and owner -->
|
||||
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %}
|
||||
{% if roles.stock.change %}
|
||||
<div class='btn-group'>
|
||||
<button id='stock-actions' title='{% trans "Stock 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'>
|
||||
<li>
|
||||
<a href='#' id='location-count'>
|
||||
<span class='fas fa-clipboard-list'></span>
|
||||
{% trans "Count stock" %}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='#' id='location-move'>
|
||||
<span class='fas fa-exchange-alt'></span>
|
||||
{% trans "Transfer stock" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if roles.stock_location.change %}
|
||||
<div class='btn-group'>
|
||||
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
<li><a href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
|
||||
{% if roles.stock.delete %}
|
||||
<li><a href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
{% if location %}
|
||||
<h3>{% trans "Location Details" %}</h3>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-sitemap'></span></td>
|
||||
<td>{% trans "Location Path" %}</td>
|
||||
<td>{{ location.pathstring }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-info-circle'></span></td>
|
||||
<td>{% trans "Location Description" %}</td>
|
||||
<td>{{ location.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "Sublocations" %}</td>
|
||||
<td>{{ location.children.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-boxes'></span></td>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ location.item_count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% else %}
|
||||
<h3>{% trans "Stock Details" %}</h3>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "Stock Locations" %}</td>
|
||||
<td>{{ loc_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-boxes'></span></td>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ stock_count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block location_content %}
|
||||
{% block details_right %}
|
||||
{% if location %}
|
||||
<table class='table table-striped table-condensed'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-info-circle'></span></td>
|
||||
<td>{% trans "Description" %}</td>
|
||||
<td>{{ location.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "Sublocations" %}</td>
|
||||
<td>{{ location.children.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-boxes'></span></td>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ location.item_count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% else %}
|
||||
<table class='table table-striped table-condensed'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "Stock Locations" %}</td>
|
||||
<td>{{ loc_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-boxes'></span></td>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ stock_count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-stock'>
|
||||
{% block page_content %}
|
||||
|
||||
<div class='panel panel-hidden' id='panel-stock'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Stock Items" %}</h4>
|
||||
</div>
|
||||
{% include "stock_table.html" %}
|
||||
<div class='panel-content'>
|
||||
{% include "stock_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-sublocations'>
|
||||
<div class='panel panel-hidden' id='panel-sublocations'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Sublocations" %}</h4>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='sublocation-button-toolbar'>
|
||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||
<div class='btn-group' role='group'>
|
||||
<!-- Printing actions menu -->
|
||||
<div class='btn-group'>
|
||||
<button id='location-print-options' class='btn btn-primary dropdown-toggle' type='button' data-toggle="dropdown" title='{% trans "Printing Actions" %}'>
|
||||
<div class='btn-group' role='group'>
|
||||
<button id='location-print-options' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown" title='{% trans "Printing Actions" %}'>
|
||||
<span class='fas fa-print'></span> <span class='caret'></span>
|
||||
</button>
|
||||
<ul class='dropdown-menu'>
|
||||
<li><a href='#' id='multi-location-print-label' title='{% trans "Print labels" %}'><span class='fas fa-tags'></span> {% trans "Print labels" %}</a></li>
|
||||
<li><a class='dropdown-item' href='#' id='multi-location-print-label' title='{% trans "Print labels" %}'><span class='fas fa-tags'></span> {% trans "Print labels" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='filter-list' id='filter-list-location'>
|
||||
<!-- An empty div in which the filter list will be constructed -->
|
||||
</div>
|
||||
{% include "filter_list.html" with id="location" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -178,18 +173,9 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
enableNavbar({
|
||||
label: 'location',
|
||||
toggleId: '#location-menu-toggle'
|
||||
});
|
||||
|
||||
loadStockLocationTable($('#sublocation-table'), {
|
||||
params: {
|
||||
{% if location %}
|
||||
@ -349,9 +335,6 @@
|
||||
url: "{% url 'api-stock-list' %}",
|
||||
});
|
||||
|
||||
attachNavCallbacks({
|
||||
name: 'stocklocation',
|
||||
default: 'stock'
|
||||
});
|
||||
enableSidebar('stocklocation');
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,25 +0,0 @@
|
||||
{% load i18n %}
|
||||
|
||||
<ul class='list-group'>
|
||||
|
||||
<li class='list-group-item'>
|
||||
<a href='#' id='location-menu-toggle'>
|
||||
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item' title='{% trans "Sublocations" %}'>
|
||||
<a href='#' id='select-sublocations' class='nav-toggle'>
|
||||
<span class='fas fa-sitemap sidebar-icon'></span>
|
||||
{% trans "Sublocations" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Stock Items" %}'>
|
||||
<a href='#' id='select-stock' class='nav-toggle'>
|
||||
<span class='fas fa-boxes sidebar-icon'></span>
|
||||
{% trans "Stock Items" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
6
InvenTree/stock/templates/stock/location_sidebar.html
Normal file
6
InvenTree/stock/templates/stock/location_sidebar.html
Normal file
@ -0,0 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
{% include "sidebar_item.html" with label='sublocations' text="Sublocations" icon="fa-sitemap" %}
|
||||
{% include "sidebar_item.html" with label='stock' text="Stock Items" icon="fa-boxes" %}
|
@ -1,61 +0,0 @@
|
||||
{% load i18n %}
|
||||
|
||||
<ul class='list-group'>
|
||||
|
||||
<li class='list-group-item'>
|
||||
<a href='#' id='item-menu-toggle'>
|
||||
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item' title='{% trans "Stock Item Tracking" %}'>
|
||||
<a href='#' id='select-history' class='nav-toggle'>
|
||||
<span class='fas fa-history sidebar-icon'></span>
|
||||
{% trans "History" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if item.part.trackable %}
|
||||
<li class='list-group-item' title='{% trans "Test Data" %}'>
|
||||
<a href='#' id='select-test-data' class='nav-toggle'>
|
||||
<span class='fas fa-vial sidebar-icon'></span>
|
||||
{% trans "Test Data" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{% if item.part.assembly %}
|
||||
<li class='list-group-item' title='{% trans "Installed Stock Items" %}'>
|
||||
<a href='#' id='select-installed-items' class='nav-toggle'>
|
||||
<span class='fas fa-sign-in-alt sidebar-icon'></span>
|
||||
{% trans "Installed Items" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if item.child_count > 0 %}
|
||||
<li class='list-group-item' title='{% trans "Child Items" %}'>
|
||||
<a href='#' id='select-children' class='nav-toggle'>
|
||||
<span class='fas fa-sitemap sidebar-icon'></span>
|
||||
{% trans "Children" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<li class='list-group-item' title='{% trans "Attachments" %}'>
|
||||
<a href='#' id='select-attachments' class='nav-toggle'>
|
||||
<span class='fas fa-paperclip sidebar-icon'></span>
|
||||
{% trans "Attachments" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class='list-group-item' title='{% trans "Stock Item Notes" %}'>
|
||||
<a href='#' id='select-notes' class='nav-toggle'>
|
||||
<span class='fas fa-clipboard sidebar-icon'></span>
|
||||
{% trans "Notes" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
@ -1,4 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "page_base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
@ -17,28 +17,10 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block pre_content %}
|
||||
{% block breadcrumbs %}
|
||||
{% if item %}
|
||||
{% include 'stock/loc_link.html' with location=item.location %}
|
||||
{% else %}
|
||||
{% include 'stock/loc_link.html' with location=location %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
loadTree("{% url 'api-stock-tree' %}",
|
||||
"#stock-tree",
|
||||
{
|
||||
name: 'stock',
|
||||
}
|
||||
);
|
||||
|
||||
initNavTree({
|
||||
label: 'stock',
|
||||
treeId: '#sidenav-left',
|
||||
toggleId: '#toggle-stock-tree',
|
||||
});
|
||||
|
||||
{% endblock %}
|
16
InvenTree/stock/templates/stock/stock_sidebar.html
Normal file
16
InvenTree/stock/templates/stock/stock_sidebar.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
{% include "sidebar_item.html" with label='history' text="Stock Tracking" icon="fa-history" %}
|
||||
{% if item.part.trackable %}
|
||||
{% include "sidebar_item.html" with label='test-data' text="Test Data" icon="fa-vial" %}
|
||||
{% endif %}
|
||||
{% if item.part.assembly %}
|
||||
{% include "sidebar_item.html" with label='installed-items' text="Installed Items" icon="fa-sign-in-alt" %}
|
||||
{% endif %}
|
||||
{% if item.child_count > 0 %}
|
||||
{% include "sidebar_item.html" with label='children' text="Child Items" icon="fa-sitemap" %}
|
||||
{% endif %}
|
||||
{% include "sidebar_item.html" with label='attachments' text="Attachments" icon="fa-paperclip" %}
|
||||
{% include "sidebar_item.html" with label='notes' text="Notes" icon="fa-clipboard" %}
|
Reference in New Issue
Block a user