mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1532 from eeintech/purchase_order_fixes
Purchase order fixes
This commit is contained in:
commit
dd03efe5f2
@ -337,14 +337,16 @@ class PurchaseOrder(Order):
|
||||
raise ValidationError({"status": _("Lines can only be received against an order marked as 'Placed'")})
|
||||
|
||||
try:
|
||||
if not (quantity % 1 == 0):
|
||||
raise ValidationError({"quantity": _("Quantity must be an integer")})
|
||||
if quantity < 0:
|
||||
raise ValidationError({"quantity": _("Quantity must be a positive number")})
|
||||
quantity = int(quantity)
|
||||
if quantity <= 0:
|
||||
raise ValidationError({"quantity": _("Quantity must be greater than zero")})
|
||||
except ValueError:
|
||||
except (ValueError, TypeError):
|
||||
raise ValidationError({"quantity": _("Invalid quantity provided")})
|
||||
|
||||
# Create a new stock item
|
||||
if line.part:
|
||||
if line.part and quantity > 0:
|
||||
stock = stock_models.StockItem(
|
||||
part=line.part.part,
|
||||
supplier_part=line.part,
|
||||
|
@ -171,11 +171,35 @@ $("#edit-order").click(function() {
|
||||
);
|
||||
});
|
||||
|
||||
$("#receive-order").click(function() {
|
||||
launchModalForm("{% url 'po-receive' order.id %}", {
|
||||
reload: true,
|
||||
secondary: [
|
||||
{
|
||||
field: 'location',
|
||||
label: '{% trans "New Location" %}',
|
||||
title: '{% trans "Create new stock location" %}',
|
||||
url: "{% url 'stock-location-create' %}",
|
||||
},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
$("#complete-order").click(function() {
|
||||
launchModalForm("{% url 'po-complete' order.id %}", {
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
$("#cancel-order").click(function() {
|
||||
launchModalForm("{% url 'po-cancel' order.id %}", {
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
$("#export-order").click(function() {
|
||||
location.href = "{% url 'po-export' order.id %}";
|
||||
});
|
||||
|
||||
|
||||
{% endblock %}
|
@ -4,6 +4,8 @@
|
||||
|
||||
{% block pre_form_content %}
|
||||
|
||||
{% trans "Cancelling this order means that the order will no longer be editable." %}
|
||||
<div class='alert alert-danger alert-block'>
|
||||
{% trans "Cancelling this order means that the order and line items will no longer be editable." %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -6,9 +6,9 @@
|
||||
|
||||
{% trans 'Mark this order as complete?' %}
|
||||
{% if not order.is_complete %}
|
||||
<div class='alert alert-warning alert-block'>
|
||||
{% trans 'This order has line items which have not been marked as received.' %}
|
||||
{% trans 'Marking this order as complete will remove these line items.' %}
|
||||
<div class='alert alert-warning alert-block' style='margin-top:12px'>
|
||||
{% trans 'This order has line items which have not been marked as received.' %}</br>
|
||||
{% trans 'Completing this order means that the order and line items will no longer be editable.' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
{% block pre_form_content %}
|
||||
|
||||
{% trans 'After placing this purchase order, line items will no longer be editable.' %}
|
||||
<div class='alert alert-warning alert-block'>
|
||||
{% trans 'After placing this purchase order, line items will no longer be editable.' %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@ -35,31 +35,6 @@
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
|
||||
$("#receive-order").click(function() {
|
||||
launchModalForm("{% url 'po-receive' order.id %}", {
|
||||
reload: true,
|
||||
secondary: [
|
||||
{
|
||||
field: 'location',
|
||||
label: '{% trans "New Location" %}',
|
||||
title: '{% trans "Create new stock location" %}',
|
||||
url: "{% url 'stock-location-create' %}",
|
||||
},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
$("#complete-order").click(function() {
|
||||
launchModalForm("{% url 'po-complete' order.id %}", {
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
$("#export-order").click(function() {
|
||||
location.href = "{% url 'po-export' order.id %}";
|
||||
});
|
||||
|
||||
{% if order.status == PurchaseOrderStatus.PENDING %}
|
||||
$('#new-po-line').click(function() {
|
||||
launchModalForm("{% url 'po-line-item-create' %}",
|
||||
@ -261,5 +236,4 @@ $("#po-table").inventreeTable({
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
{% endblock %}
|
@ -16,7 +16,7 @@
|
||||
</button>
|
||||
|
||||
{% if owner_control.value == "True" and user in owners or user.is_superuser or owner_control.value == "False" %}
|
||||
{% if roles.stock.add %}
|
||||
{% if not read_only and roles.stock.add %}
|
||||
<button class="btn btn-success" id='item-create' title='{% trans "New Stock Item" %}'>
|
||||
<span class='fas fa-plus-circle'></span>
|
||||
</button>
|
||||
@ -44,6 +44,7 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if not read_only %}
|
||||
{% if roles.stock.change or roles.stock.delete %}
|
||||
<div class="btn-group">
|
||||
<button id='stock-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" title='{% trans "Stock Options" %}'>
|
||||
@ -65,6 +66,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<div class='filter-list' id='filter-list-stock'>
|
||||
<!-- An empty div in which the filter list will be constructed -->
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user