mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
Purchase order fixes
This commit is contained in:
@ -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:
|
||||
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 %}
|
Reference in New Issue
Block a user