2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-10 22:00:56 +00:00

Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2788

This commit is contained in:
Matthias
2022-05-04 12:33:21 +02:00
45 changed files with 985 additions and 787 deletions

View File

@@ -312,7 +312,7 @@ class SupplierPartList(generics.ListCreateAPIView):
try:
params = self.request.query_params
kwargs['part_detail'] = str2bool(params.get('part_detail', None))
kwargs['supplier_detail'] = str2bool(params.get('supplier_detail', None))
kwargs['supplier_detail'] = str2bool(params.get('supplier_detail', True))
kwargs['manufacturer_detail'] = str2bool(params.get('manufacturer_detail', None))
kwargs['pretty'] = str2bool(params.get('pretty', None))
except AttributeError:

View File

@@ -325,14 +325,14 @@
var parts = [];
selections.forEach(function(item) {
parts.push(item.part);
var part = item.part_detail;
part.manufacturer_part = item.pk;
parts.push(part);
});
launchModalForm("/order/purchase-order/order-parts/", {
data: {
parts: parts,
},
});
orderParts(
parts,
);
});
{% endif %}
@@ -396,14 +396,16 @@
var parts = [];
selections.forEach(function(item) {
parts.push(item.part);
var part = item.part_detail;
parts.push(part);
});
launchModalForm("/order/purchase-order/order-parts/", {
data: {
parts: parts,
},
});
orderParts(
parts,
{
supplier: {{ company.pk }},
}
);
});
{% endif %}

View File

@@ -31,13 +31,11 @@
{% include "admin_button.html" with url=url %}
{% endif %}
{% if roles.purchase_order.change %}
{% comment "for later" %}
{% if roles.purchase_order.add %}
{% if roles.purchase_order.add and part.part.purchaseable %}
<button type='button' class='btn btn-outline-secondary' id='order-part' title='{% trans "Order part" %}'>
<span class='fas fa-shopping-cart'></span>
</button>
{% endif %}
{% endcomment %}
<button type='button' class='btn btn-outline-secondary' id='edit-part' title='{% trans "Edit manufacturer part" %}'>
<span class='fas fa-edit icon-green'/>
</button>
@@ -134,6 +132,7 @@ src="{% static 'img/blank_image.png' %}"
<li><a class='dropdown-item' href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete" %}</a></li>
</ul>
</div>
{% include "filter_list.html" with id='supplier-part' %}
</div>
</div>
@@ -304,14 +303,20 @@ linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options']);
linkButtonsToSelection($("#parameter-table"), ['#parameter-options']);
$('#order-part, #order-part2').click(function() {
launchModalForm(
"{% url 'order-parts' %}",
inventreeGet(
'{% url "api-part-detail" part.part.pk %}', {},
{
data: {
part: {{ part.part.id }},
},
reload: true,
},
success: function(response) {
orderParts([response], {
manufacturer_part: {{ part.pk }},
{% if part.manufacturer %}
manufacturer: {{ part.manufacturer.pk }},
{% endif %}
});
}
}
);
});

View File

@@ -169,7 +169,8 @@ src="{% static 'img/blank_image.png' %}"
</div>
<div class='panel-content'>
<div id='button-bar'>
<div class='btn-group'>
<div class='btn-group' role='group'>
{% include "filter_list.html" with id='purchaseorder' %}
</div>
</div>
<table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#button-bar'>
@@ -330,14 +331,19 @@ $("#item-create").click(function() {
});
$('#order-part, #order-part2').click(function() {
launchModalForm(
"{% url 'order-parts' %}",
inventreeGet(
'{% url "api-part-detail" part.part.pk %}', {},
{
data: {
part: {{ part.part.id }},
},
reload: true,
},
success: function(response) {
orderParts([response], {
supplier_part: {{ part.pk }},
{% if part.supplier %}
supplier: {{ part.supplier.pk }},
{% endif %}
});
}
}
);
});