mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master'
This commit is contained in:
commit
93eeeec2f3
@ -13,6 +13,8 @@ from django.http import StreamingHttpResponse
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from .version import inventreeVersion, inventreeInstanceName
|
||||
|
||||
|
||||
def TestIfImage(img):
|
||||
""" Test if an image file is indeed an image """
|
||||
@ -134,6 +136,8 @@ def MakeBarcode(object_type, object_id, object_url, data={}):
|
||||
data['id'] = object_id
|
||||
data['url'] = object_url
|
||||
data['tool'] = 'InvenTree'
|
||||
data['instance'] = inventreeInstanceName()
|
||||
data['version'] = inventreeVersion()
|
||||
|
||||
return json.dumps(data, sort_keys=True)
|
||||
|
||||
|
@ -113,6 +113,14 @@ function loadPurchaseOrderTable(table, options) {
|
||||
title: 'ID',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'reference',
|
||||
title: 'Purchase Order',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, "/order/purchase-order/" + row.pk + "/");
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'supplier',
|
||||
@ -121,14 +129,6 @@ function loadPurchaseOrderTable(table, options) {
|
||||
return imageHoverIcon(row.supplier__image) + renderLink(row.supplier__name, '/company/' + value + '/purchase-orders/');
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'reference',
|
||||
title: 'Reference',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, "/order/purchase-order/" + row.pk + "/");
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'creation_date',
|
||||
|
@ -3,10 +3,16 @@ Provides information on the current InvenTree version
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
INVENTREE_SW_VERSION = "0.0.10"
|
||||
|
||||
|
||||
def inventreeInstanceName():
|
||||
""" Returns the InstanceName settings for the current database """
|
||||
return InvenTreeSetting.get_setting("InstanceName", "")
|
||||
|
||||
|
||||
def inventreeVersion():
|
||||
""" Returns the InvenTree version string """
|
||||
return INVENTREE_SW_VERSION
|
||||
|
@ -22,7 +22,7 @@ from common.models import InvenTreeSetting
|
||||
|
||||
from .forms import DeleteForm, EditUserForm, SetPasswordForm
|
||||
from .helpers import str2bool
|
||||
from .version import inventreeVersion
|
||||
from .version import inventreeVersion, inventreeInstanceName
|
||||
|
||||
from rest_framework import views
|
||||
|
||||
@ -422,7 +422,8 @@ class InfoView(AjaxView):
|
||||
|
||||
data = {
|
||||
'server': 'InvenTree',
|
||||
'version': inventreeVersion()
|
||||
'version': inventreeVersion(),
|
||||
'instance': inventreeInstanceName(),
|
||||
}
|
||||
|
||||
return JsonResponse(data)
|
||||
|
@ -10,6 +10,7 @@
|
||||
<hr>
|
||||
|
||||
<table class='table table-striped'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{% trans "Title" %}</td>
|
||||
|
@ -2,7 +2,7 @@ from django.apps import AppConfig
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
import os
|
||||
|
||||
import uuid
|
||||
import yaml
|
||||
|
||||
|
||||
@ -10,14 +10,19 @@ class CommonConfig(AppConfig):
|
||||
name = 'common'
|
||||
|
||||
def ready(self):
|
||||
|
||||
""" Will be called when the Common app is first loaded """
|
||||
self.populate_default_settings()
|
||||
self.add_instance_name()
|
||||
|
||||
def populate_default_settings(self):
|
||||
""" Populate the default values for InvenTree key:value pairs.
|
||||
If a setting does not exist, it will be created.
|
||||
"""
|
||||
|
||||
# Import this here, rather than at the global-level,
|
||||
# otherwise it is called all the time, and we don't want that,
|
||||
# as the InvenTreeSetting model may have not been instantiated yet.
|
||||
from .models import InvenTreeSetting
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
@ -46,3 +51,30 @@ class CommonConfig(AppConfig):
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Migrations have not yet been applied - table does not exist
|
||||
break
|
||||
|
||||
def add_instance_name(self):
|
||||
"""
|
||||
Check if an InstanceName has been defined for this database.
|
||||
If not, create a random one!
|
||||
"""
|
||||
|
||||
# See note above
|
||||
from .models import InvenTreeSetting
|
||||
|
||||
try:
|
||||
if not InvenTreeSetting.objects.filter(key='InstanceName').exists():
|
||||
|
||||
val = uuid.uuid4().hex
|
||||
|
||||
print("No 'InstanceName' found - generating random name '{n}'".format(n=val))
|
||||
|
||||
name = InvenTreeSetting(
|
||||
key="InstanceName",
|
||||
value=val,
|
||||
description="Instance name for this InvenTree database installation."
|
||||
)
|
||||
|
||||
name.save()
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Migrations have not yet been applied - table does not exist
|
||||
pass
|
||||
|
@ -4,6 +4,9 @@
|
||||
# Note: The description strings provided here will be translatable,
|
||||
# so ensure that any translations are provided as appropriate.
|
||||
|
||||
# TODO: Update the formatting here to include logical separators e.g. double-underscore
|
||||
# TODO: This is so when there are enough options, we will be able to display them as a tree
|
||||
|
||||
- key: 'part_ipn_regex'
|
||||
default: ''
|
||||
description: 'Format string for internal part number'
|
||||
|
@ -43,6 +43,7 @@ InvenTree | {% trans "Company" %} - {{ company.name }}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<table class="table">
|
||||
<col width='25'>
|
||||
{% if company.website %}
|
||||
<tr>
|
||||
<td><span class='fas fa-link'></span></td>
|
||||
|
@ -9,14 +9,18 @@
|
||||
<hr>
|
||||
|
||||
<table class='table table-striped'>
|
||||
<tr>
|
||||
<td>{% trans "Customer" %}</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_customer %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Supplier" %}</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
|
||||
</tr>
|
||||
<col width='25'>
|
||||
<col>
|
||||
<tr>
|
||||
<td><span class='fas fa-user-tag'></span></td>
|
||||
<td>{% trans "Customer" %}</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_customer %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-industry'></span></td>
|
||||
<td>{% trans "Supplier" %}</td>
|
||||
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -60,6 +60,7 @@ InvenTree | {{ order }}
|
||||
<div class='col-sm-6'>
|
||||
<h4>{% trans "Purchase Order Details" %}</h4>
|
||||
<table class='table'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-industry'></span></td>
|
||||
<td>{% trans "Supplier" %}</td>
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated by Django 2.2.10 on 2020-04-04 12:38
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.utils import OperationalError
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
from part.models import Part
|
||||
from stdimage.utils import render_variations
|
||||
@ -17,8 +17,9 @@ def create_thumbnails(apps, schema_editor):
|
||||
# Render thumbnail for each existing Part
|
||||
if part.image:
|
||||
part.image.render_variations()
|
||||
except OperationalError:
|
||||
print("Error - could not generate Part thumbnails")
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Migrations have not yet been applied - table does not exist
|
||||
print("Could not generate Part thumbnails")
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
{% if category %}
|
||||
<h3>{% trans "Category Details" %}</h3>
|
||||
<table class='table table-condensed table-striped'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-sitemap'></span></td>
|
||||
<td>{% trans "Category Path" %}</td>
|
||||
@ -71,6 +72,7 @@
|
||||
{% else %}
|
||||
<h3>{% trans "Category Details" %}</h3>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-sitemap'></span></td>
|
||||
<td>{% trans "Part Categories" %}</td>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<table class='table table-striped'>
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><b>{% trans "Part name" %}</b></td>
|
||||
|
@ -70,6 +70,7 @@
|
||||
</div>
|
||||
</p>
|
||||
<table class='table table-condensed'>
|
||||
<col width='25'>
|
||||
{% if part.IPN %}
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -43,6 +43,12 @@ def part_allocation_count(build, part, *args, **kwargs):
|
||||
return decimal2string(build.getAllocatedQuantity(part))
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_instance_name(*args, **kwargs):
|
||||
""" Return the InstanceName associated with the current database """
|
||||
return version.inventreeInstanceName()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def inventree_version(*args, **kwargs):
|
||||
""" Return InvenTree version string """
|
||||
|
@ -73,6 +73,7 @@
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<table class="table table-striped">
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<td><span class='fas fa-shapes'></span></td>
|
||||
<td>Part</td>
|
||||
|
@ -36,6 +36,7 @@
|
||||
{% 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>
|
||||
@ -60,6 +61,7 @@
|
||||
{% 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>
|
||||
|
@ -24,10 +24,16 @@ InvenTree | Index
|
||||
{% endblock %}
|
||||
|
||||
{% block js_ready %}
|
||||
|
||||
console.log("abcde?");
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
$("#to-build-table").bootstrapTable();
|
||||
$("#to-order-table").bootstrapTable();
|
||||
$("#starred-parts-table").bootstrapTable();
|
||||
//TODO: These calls to bootstrapTable() are failing, for some reason?
|
||||
//$("#to-build-table").bootstrapTable();
|
||||
//$("#to-order-table").bootstrapTable();
|
||||
//$("#starred-parts-table").bootstrapTable();
|
||||
|
||||
console.log("Got to here...");
|
||||
|
||||
{% endblock %}
|
@ -10,35 +10,41 @@
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<img src="{% static 'img/inventree.png' %}" height='60' style='float: left;' alt='Inventree Logo'>
|
||||
<h3>{% trans "InvenTree Version Information" %}</h3>
|
||||
</div>
|
||||
<div class='modal-form-content'>
|
||||
<div>
|
||||
<!--
|
||||
-->
|
||||
<h4>{% trans "InvenTree Version Information" %}</h4>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<tr>
|
||||
<td>{% trans "Version" %}</td><td><a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a></td>
|
||||
<td></td>
|
||||
<td>{% trans "Instance Name" %}</td>
|
||||
<td>{% inventree_instance_name %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-hashtag'></span></td>
|
||||
<td>{% trans "InvenTree Version" %}</td><td><a href="https://github.com/inventree/InvenTree/releases">{% inventree_version %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-code-branch'></span></td>
|
||||
<td>{% trans "Commit Hash" %}</td><td><a href="https://github.com/inventree/InvenTree/commit/{% inventree_commit_hash %}">{% inventree_commit_hash %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Commit Date" %}</td><td>{% inventree_commit_date %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-book'></span></td>
|
||||
<td>{% trans "InvenTree Documentation" %}</td>
|
||||
<td><a href="{% inventree_docs_url %}">{% inventree_docs_url %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fab fa-github'></span></td>
|
||||
<td>{% trans "View Code on GitHub" %}</td><td><a href="{% inventree_github_url %}">{% inventree_github_url %}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><a href='https://github.com/inventree/InvenTree/issues'><button class='btn btn-default'>Submit Bug Report</button></a></td>
|
||||
<td><span class='fas fa-exclamation-circle'></span></td>
|
||||
<td>{% trans "Submit Bug Report" %}</td>
|
||||
<td><a href='{% inventree_github_url %}/issues'>{% inventree_github_url %}/issues</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap_3.3.7_css_bootstrap.min.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'css/bootstrap-table.css' %}">
|
||||
@ -108,6 +109,7 @@ InvenTree
|
||||
<script type='text/javascript' src="{% static 'script/inventree/sidenav.js' %}"></script>
|
||||
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.js' %}"></script>
|
||||
|
||||
{% block js_load %}
|
||||
|
@ -1,11 +1,11 @@
|
||||
<table class='table table-striped table-condensed' id='{{ table_id }}'>
|
||||
<tr>
|
||||
<th>Part</th>
|
||||
<th>Description</th>
|
||||
<th>In Stock</th>
|
||||
<th>On Order</th>
|
||||
<th>Allocted</th>
|
||||
<th>Net Stock</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>Part</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>Description</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>In Stock</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>On Order</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>Allocted</th>
|
||||
<th data-field='part' data-sortable='true' data-searchable='true'>Net Stock</th>
|
||||
</tr>
|
||||
{% for part in parts %}
|
||||
<tr>
|
||||
|
@ -7,22 +7,26 @@
|
||||
<td colspan='2'><b>{% trans "Parts" %}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Parts" %}</td>
|
||||
<td>{{ part_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-sitemap'></span></td>
|
||||
<td>{% trans "Part Categories" %}</td>
|
||||
<td>{{ part_cat_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-shapes'></span></td>
|
||||
<td>{% trans "Parts" %}</td>
|
||||
<td>{{ part_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>{% trans "Stock Items" %}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ stock_item_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
<td>{% trans "Stock Locations" %}</td>
|
||||
<td>{{ stock_loc_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-boxes'></span></td>
|
||||
<td>{% trans "Stock Items" %}</td>
|
||||
<td>{{ stock_item_count }}</td>
|
||||
</tr>
|
||||
</table>
|
Loading…
Reference in New Issue
Block a user