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
fb0ebbb1e4
@ -72,6 +72,27 @@ if DEBUG:
|
|||||||
format='%(asctime)s %(levelname)s %(message)s',
|
format='%(asctime)s %(levelname)s %(message)s',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Does the user wish to use the sentry.io integration?
|
||||||
|
sentry_opts = CONFIG.get('sentry', {})
|
||||||
|
|
||||||
|
if sentry_opts.get('enabled', False):
|
||||||
|
dsn = sentry_opts.get('dsn', None)
|
||||||
|
|
||||||
|
if dsn is not None:
|
||||||
|
# Try to import required modules (exit if not installed)
|
||||||
|
try:
|
||||||
|
import sentry_sdk
|
||||||
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
|
|
||||||
|
sentry_sdk.init(dsn=dsn, integrations=[DjangoIntegration()], send_default_pii=True)
|
||||||
|
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("sentry_sdk module not found. Install using 'pip install sentry-sdk'")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Warning: Sentry.io DSN not specified")
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
@ -20,6 +20,9 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
<p>{{ part.supplier.name }} - {{ part.SKU }}</p>
|
<p>{{ part.supplier.name }} - {{ part.SKU }}</p>
|
||||||
<div class='btn-row'>
|
<div class='btn-row'>
|
||||||
<div class='btn-group action-buttons' role='group'>
|
<div class='btn-group action-buttons' role='group'>
|
||||||
|
<button type='button' class='btn btn-default btn-glyph' id='order-part' title='{% trans "Order part" %}'>
|
||||||
|
<span class='fas fa-shopping-cart'></span>
|
||||||
|
</button>
|
||||||
<button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit supplier part" %}'>
|
<button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit supplier part" %}'>
|
||||||
<span class='fas fa-edit icon-green'/>
|
<span class='fas fa-edit icon-green'/>
|
||||||
</button>
|
</button>
|
||||||
@ -91,6 +94,18 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
|
$('#order-part').click(function() {
|
||||||
|
launchModalForm(
|
||||||
|
"{% url 'order-parts' %}",
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
part: {{ part.part.id }},
|
||||||
|
},
|
||||||
|
reload: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
$('#edit-part').click(function () {
|
$('#edit-part').click(function () {
|
||||||
launchModalForm(
|
launchModalForm(
|
||||||
"{% url 'supplier-part-edit' part.id %}",
|
"{% url 'supplier-part-edit' part.id %}",
|
||||||
|
@ -65,4 +65,11 @@ log_queries: False
|
|||||||
# Backup options
|
# Backup options
|
||||||
# Set the backup_dir parameter to store backup files in a specific location
|
# Set the backup_dir parameter to store backup files in a specific location
|
||||||
# If unspecified, the local user's temp directory will be used
|
# If unspecified, the local user's temp directory will be used
|
||||||
#backup_dir: '/home/inventree/backup/'
|
#backup_dir: '/home/inventree/backup/'
|
||||||
|
|
||||||
|
# Sentry.io integration
|
||||||
|
# If you have a sentry.io account, it can be used to log server errors
|
||||||
|
# Ensure sentry_sdk is installed by running 'pip install sentry-sdk'
|
||||||
|
sentry:
|
||||||
|
enabled: False
|
||||||
|
# dsn: add-your-sentry-dsn-here
|
||||||
|
@ -766,6 +766,7 @@ class OrderParts(AjaxView):
|
|||||||
|
|
||||||
for supplier in self.suppliers:
|
for supplier in self.suppliers:
|
||||||
supplier.order_items = []
|
supplier.order_items = []
|
||||||
|
|
||||||
suppliers[supplier.name] = supplier
|
suppliers[supplier.name] = supplier
|
||||||
|
|
||||||
for part in self.parts:
|
for part in self.parts:
|
||||||
@ -778,7 +779,15 @@ class OrderParts(AjaxView):
|
|||||||
|
|
||||||
if supplier.name not in suppliers:
|
if supplier.name not in suppliers:
|
||||||
supplier.order_items = []
|
supplier.order_items = []
|
||||||
supplier.selected_purchase_order = None
|
|
||||||
|
# Attempt to auto-select a purchase order
|
||||||
|
orders = PurchaseOrder.objects.filter(supplier=supplier, status__in=PurchaseOrderStatus.OPEN)
|
||||||
|
|
||||||
|
if orders.count() == 1:
|
||||||
|
supplier.selected_purchase_order = orders.first().id
|
||||||
|
else:
|
||||||
|
supplier.selected_purchase_order = None
|
||||||
|
|
||||||
suppliers[supplier.name] = supplier
|
suppliers[supplier.name] = supplier
|
||||||
|
|
||||||
suppliers[supplier.name].order_items.append(part)
|
suppliers[supplier.name].order_items.append(part)
|
||||||
|
@ -526,7 +526,7 @@ class Part(models.Model):
|
|||||||
This number (unlike 'available_stock') can be negative.
|
This number (unlike 'available_stock') can be negative.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self.total_stock - self.allocation_count + self.on_order
|
return self.total_stock - self.allocation_count() + self.on_order
|
||||||
|
|
||||||
def isStarredBy(self, user):
|
def isStarredBy(self, user):
|
||||||
""" Return True if this part has been starred by a particular user """
|
""" Return True if this part has been starred by a particular user """
|
||||||
|
@ -108,11 +108,18 @@
|
|||||||
<td>{% include "part/stock_count.html" %}</td>
|
<td>{% include "part/stock_count.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if not part.is_template %}
|
{% if not part.is_template %}
|
||||||
{% if part.allocation_count > 0 %}
|
{% if part.build_order_allocation_count > 0 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-dolly'></span></td>
|
<td><span class='fas fa-dolly'></span></td>
|
||||||
<td>{% trans "Allocated" %}</td>
|
<td>{% trans "Allocated to Build Orders" %}</td>
|
||||||
<td>{% decimal part.allocation_count %}</td>
|
<td>{% decimal part.build_order_allocation_count %}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% if part.sales_order_allocation_count > 0 %}
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-dolly'></span></td>
|
||||||
|
<td>{% trans "Allocated to Sales Orders" %}</td>
|
||||||
|
<td>{% decimal part.sales_order_allocation_count %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if part.on_order > 0 %}
|
{% if part.on_order > 0 %}
|
||||||
|
Loading…
Reference in New Issue
Block a user