mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 05:25:42 +00:00
Merge branch 'master' into partial-shipment
# Conflicts: # InvenTree/company/templates/company/company_base.html # InvenTree/stock/templates/stock/item_base.html
This commit is contained in:
@ -180,9 +180,9 @@
|
||||
<script type='text/javascript' src="{% i18n_static 'tables.js' %}"></script>
|
||||
<script type='text/javascript' src="{% i18n_static 'table_filters.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>
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/solid.min.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/brands.min.js' %}"></script>
|
||||
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.min.js' %}"></script>
|
||||
|
||||
{% block js_load %}
|
||||
{% endblock %}
|
||||
|
@ -796,6 +796,11 @@ function loadPurchaseOrderTable(table, options) {
|
||||
switchable: true,
|
||||
sortable: false,
|
||||
formatter: function(value, row) {
|
||||
|
||||
if (!row.responsible_detail) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
var html = row.responsible_detail.name;
|
||||
|
||||
if (row.responsible_detail.label == 'group') {
|
||||
|
@ -44,6 +44,7 @@
|
||||
editStockItem,
|
||||
editStockLocation,
|
||||
exportStock,
|
||||
findStockItemBySerialNumber,
|
||||
loadInstalledInTable,
|
||||
loadStockLocationTable,
|
||||
loadStockTable,
|
||||
@ -397,6 +398,87 @@ function createNewStockItem(options={}) {
|
||||
constructForm(url, options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Launch a modal form to find a particular stock item by serial number.
|
||||
* Arguments:
|
||||
* - part: ID (PK) of the part in question
|
||||
*/
|
||||
|
||||
function findStockItemBySerialNumber(part_id) {
|
||||
|
||||
constructFormBody({}, {
|
||||
title: '{% trans "Find Serial Number" %}',
|
||||
fields: {
|
||||
serial: {
|
||||
label: '{% trans "Serial Number" %}',
|
||||
help_text: '{% trans "Enter serial number" %}',
|
||||
placeholder: '{% trans "Enter serial number" %}',
|
||||
required: true,
|
||||
type: 'string',
|
||||
value: '',
|
||||
}
|
||||
},
|
||||
onSubmit: function(fields, opts) {
|
||||
|
||||
var serial = getFormFieldValue('serial', fields['serial'], opts);
|
||||
|
||||
serial = serial.toString().trim();
|
||||
|
||||
if (!serial) {
|
||||
handleFormErrors(
|
||||
{
|
||||
'serial': [
|
||||
'{% trans "Enter a serial number" %}',
|
||||
]
|
||||
}, fields, opts
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
inventreeGet(
|
||||
'{% url "api-stock-list" %}',
|
||||
{
|
||||
part_tree: part_id,
|
||||
serial: serial,
|
||||
},
|
||||
{
|
||||
success: function(response) {
|
||||
if (response.length == 0) {
|
||||
// No results!
|
||||
handleFormErrors(
|
||||
{
|
||||
'serial': [
|
||||
'{% trans "No matching serial number" %}',
|
||||
]
|
||||
}, fields, opts
|
||||
);
|
||||
} else if (response.length > 1) {
|
||||
// Too many results!
|
||||
handleFormErrors(
|
||||
{
|
||||
'serial': [
|
||||
'{% trans "More than one matching result found" %}',
|
||||
]
|
||||
}, fields, opts
|
||||
);
|
||||
} else {
|
||||
$(opts.modal).modal('hide');
|
||||
|
||||
// Redirect
|
||||
var pk = response[0].pk;
|
||||
location.href = `/stock/item/${pk}/`;
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
showApiError(xhr, opts.url);
|
||||
$(opts.modal).modal('hide');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Stock API functions
|
||||
* Requires api.js to be loaded first
|
||||
|
@ -24,29 +24,35 @@
|
||||
|
||||
{% block page_info %}
|
||||
<div class='panel-content'>
|
||||
<div class='row'>
|
||||
<div class='col-sm-6' id='detail-panel-left'>
|
||||
<div class='card'>
|
||||
{% block details_left %}
|
||||
<div class='row g-0'>
|
||||
<div class='col-md-4'>
|
||||
{% block thumbnail %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
{% block details %}
|
||||
{% endblock %}
|
||||
{% block details_above %}
|
||||
{% endblock details_above %}
|
||||
<div class='container' style='max-width: 100%; padding: 5px;'>
|
||||
<div class='row'>
|
||||
<div class='col' id='detail-panel-left'>
|
||||
<div class='card'>
|
||||
{% block details_left %}
|
||||
<div class='row'>
|
||||
<div class='col' style='max-width: 220px;'>
|
||||
{% block thumbnail %}
|
||||
{% endblock thumbnail %}
|
||||
</div>
|
||||
<div class='col'>
|
||||
{% block details %}
|
||||
{% endblock details %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock details_left %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-sm-6' id='detail-panel-right'>
|
||||
<div class='card'>
|
||||
{% block details_right %}
|
||||
block details_right
|
||||
{% endblock %}
|
||||
<div class='col' id='detail-panel-right'>
|
||||
<div class='card'>
|
||||
{% block details_right %}
|
||||
block details_right
|
||||
{% endblock details_right %}
|
||||
</div>
|
||||
</div>
|
||||
{% block details_below %}
|
||||
{% endblock details_below %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user