2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

Updated template stock item logic and added to stock locations

This commit is contained in:
eeintech 2020-12-01 17:41:03 -05:00
parent 4104e7df8e
commit 8dac6bb982
4 changed files with 84 additions and 53 deletions

View File

@ -8,11 +8,12 @@
{% include "stock/tabs.html" with tab="tracking" %}
{% setting_object 'STOCK_OWNER' as owner_enable %}
<h4>{% trans "Stock Tracking Information" %}</h4>
<hr>
<!-- Check permissions and owner -->
{% setting_object 'STOCK_OWNER' as owner_enable %}
{% if owner_enable.value == "False" or owner_enable.value == "True" and item.owner == user %}
{% if roles.stock.change and not item.is_building %}
<div id='table-toolbar'>

View File

@ -15,6 +15,8 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% block pre_content %}
{% include 'stock/loc_link.html' with location=item.location %}
{% setting_object 'STOCK_OWNER' as owner_enable %}
{% if item.is_building %}
<div class='alert alert-block alert-info'>
{% trans "This stock item is in production and cannot be edited." %}<br>
@ -29,6 +31,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
</div>
{% endif %}
{% if owner_enable.value == "True" and not item.owner == user and not user.is_superuser %}
<div class='alert alert-block alert-info'>
{% trans "You are not the owner of this item. This stock item cannot be edited." %}<br>
</div>
{% endif %}
{% if item.hasRequiredTests and not item.passedAllRequiredTests %}
<div class='alert alert-block alert-danger'>
{% trans "This stock item has not passed all required tests" %}
@ -68,6 +76,9 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endblock %}
{% block page_data %}
{% setting_object 'STOCK_OWNER' as owner_enable %}
<h3>
{% trans "Stock Item" %}
{% stock_status_label item.status large=True %}
@ -113,8 +124,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
</div>
<!-- Stock adjustment menu -->
<!-- Check permissions and owner -->
{% setting_object 'STOCK_OWNER' as owner_enable %}
{% if owner_enable.value == "False" or owner_enable.value == "True" and item.owner == user %}
{% if owner_enable.value == "False" or owner_enable.value == "True" and item.owner == user or user.is_superuser %}
{% if roles.stock.change and not item.is_building %}
<div class='btn-group'>
<button id='stock-options' 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>

View File

@ -1,8 +1,17 @@
{% extends "stock/stock_app_base.html" %}
{% load static %}
{% load inventree_extras %}
{% load i18n %}
{% block content %}
{% setting_object 'STOCK_OWNER' as owner_enable %}
{% if location and owner_enable.value == "True" and not location.owner in user.groups.all and not user.is_superuser %}
<div class='alert alert-block alert-info'>
{% trans "You are not in the list of owners of this location. This stock location cannot be edited." %}<br>
</div>
{% endif %}
<div class='row'>
<div class='col-sm-6'>
{% if location %}
@ -18,11 +27,13 @@
<p>{% trans "All stock items" %}</p>
{% endif %}
<div class='btn-group action-buttons' role='group'>
{% if owner_enable.value == "False" or owner_enable.value == "True" and location.owner in user.groups.all or user.is_superuser or not location %}
{% if roles.stock.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 %}
<!-- Barcode actions menu -->
{% if location %}
<div class='btn-group'>
@ -33,6 +44,8 @@
<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_enable.value == "False" or owner_enable.value == "True" and location.owner in user.groups.all 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>
@ -52,6 +65,7 @@
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
<div class='col-sm-6'>

View File

@ -1,4 +1,7 @@
{% load i18n %}
{% load inventree_extras %}
{% setting_object 'STOCK_OWNER' as owner_enable %}
<div id='button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
@ -8,6 +11,8 @@
</button>
{% if read_only %}
{% else %}
<!-- Check permissions and owner -->
{% if owner_enable.value == "False" or owner_enable.value == "True" and location.owner in user.groups.all %}
{% if roles.stock.add %}
<button class="btn btn-success" id='item-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Stock Item" %}
@ -31,6 +36,7 @@
</div>
{% endif %}
{% endif %}
{% endif %}
</div>
<div class='filter-list' id='filter-list-stock'>
<!-- An empty div in which the filter list will be constructed -->