mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Merge remote-tracking branch 'inventree/master' into partial-shipment
# Conflicts: # InvenTree/InvenTree/version.py # InvenTree/order/models.py
This commit is contained in:
@ -83,7 +83,9 @@ class POLineItemResource(ModelResource):
|
||||
|
||||
|
||||
class SOLineItemResource(ModelResource):
|
||||
""" Class for managing import / export of SOLineItem data """
|
||||
"""
|
||||
Class for managing import / export of SOLineItem data
|
||||
"""
|
||||
|
||||
part_name = Field(attribute='part__name', readonly=True)
|
||||
|
||||
@ -93,6 +95,17 @@ class SOLineItemResource(ModelResource):
|
||||
|
||||
fulfilled = Field(attribute='fulfilled_quantity', readonly=True)
|
||||
|
||||
def dehydrate_sale_price(self, item):
|
||||
"""
|
||||
Return a string value of the 'sale_price' field, rather than the 'Money' object.
|
||||
Ref: https://github.com/inventree/InvenTree/issues/2207
|
||||
"""
|
||||
|
||||
if item.sale_price:
|
||||
return str(item.sale_price)
|
||||
else:
|
||||
return ''
|
||||
|
||||
class Meta:
|
||||
model = SalesOrderLineItem
|
||||
skip_unchanged = True
|
||||
|
@ -37,7 +37,7 @@ def get_next_po_number():
|
||||
"""
|
||||
|
||||
if PurchaseOrder.objects.count() == 0:
|
||||
return "001"
|
||||
return '0001'
|
||||
|
||||
order = PurchaseOrder.objects.exclude(reference=None).last()
|
||||
|
||||
@ -66,7 +66,7 @@ def get_next_so_number():
|
||||
"""
|
||||
|
||||
if SalesOrder.objects.count() == 0:
|
||||
return "001"
|
||||
return '0001'
|
||||
|
||||
order = SalesOrder.objects.exclude(reference=None).last()
|
||||
|
||||
|
@ -241,6 +241,7 @@ class POLineItemReceiveSerializer(serializers.Serializer):
|
||||
help_text=_('Unique identifier field'),
|
||||
default='',
|
||||
required=False,
|
||||
allow_null=True,
|
||||
allow_blank=True,
|
||||
)
|
||||
|
||||
|
@ -29,7 +29,9 @@
|
||||
<span class='fas fa-print'></span> <span class='caret'></span>
|
||||
</button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
{% if report_enabled %}
|
||||
<li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print purchase order report" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -123,7 +125,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Created" %}</td>
|
||||
<td>{{ order.creation_date }}<span class='badge'>{{ order.created_by }}</span></td>
|
||||
<td>{{ order.creation_date }}<span class='badge badge-right rounded-pill bg-dark'>{{ order.created_by }}</span></td>
|
||||
</tr>
|
||||
{% if order.issue_date %}
|
||||
<tr>
|
||||
@ -143,7 +145,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Received" %}</td>
|
||||
<td>{{ order.complete_date }}<span class='badge'>{{ order.received_by }}</span></td>
|
||||
<td>{{ order.complete_date }}<span class='badge badge-right rounded-pill bg-dark'>{{ order.received_by }}</span></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.responsible %}
|
||||
@ -169,9 +171,11 @@ $("#place-order").click(function() {
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% if report_enabled %}
|
||||
$('#print-order-report').click(function() {
|
||||
printPurchaseOrderReports([{{ order.pk }}]);
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
$("#edit-order").click(function() {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
<div class='panel panel-hidden' id='panel-order-items'>
|
||||
<div class='panel-heading'>
|
||||
<div class='d-flex flex-row'>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Purchase Order Items" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
@ -37,9 +37,7 @@
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
|
||||
<div class='filter-list' id='filter-list-purchase-order-lines'>
|
||||
<!-- An empty div in which the filter list will be constructed-->
|
||||
</div>
|
||||
{% include "filter_list.html" with id="order-lines" %}
|
||||
</div>
|
||||
|
||||
<table class='table table-striped table-condensed' id='po-line-table' data-toolbar='#order-toolbar-buttons'>
|
||||
@ -52,13 +50,13 @@
|
||||
<h4>{% trans "Received Items" %}</h4>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% include "stock_table.html" with prevent_new_stock=True %}
|
||||
{% include "stock_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-hidden' id='panel-order-attachments'>
|
||||
<div class='panel-heading'>
|
||||
<div class='d-flex flex-row'>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Attachments" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
|
@ -26,19 +26,18 @@
|
||||
<div id='table-buttons'>
|
||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||
<div class='btn-group' role='group'>
|
||||
|
||||
{% if report_enabled %}
|
||||
<button id='order-print' class='btn btn-outline-secondary' title='{% trans "Print Order Reports" %}'>
|
||||
<span class='fas fa-print'></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
<button class='btn btn-outline-secondary' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'>
|
||||
<span class='fas fa-calendar-alt'></span>
|
||||
</button>
|
||||
<button class='btn btn-outline-secondary' type='button' id='view-list' title='{% trans "Display list view" %}'>
|
||||
<span class='fas fa-th-list'></span>
|
||||
</button>
|
||||
<div class='filter-list' id='filter-list-purchaseorder'>
|
||||
<!-- An empty div in which the filter list will be constructed -->
|
||||
</div>
|
||||
{% include "filter_list.html" with id="purchaseorder" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -171,6 +170,7 @@ $("#view-list").click(function() {
|
||||
$("#view-calendar").show();
|
||||
});
|
||||
|
||||
{% if report_enabled %}
|
||||
$("#order-print").click(function() {
|
||||
var rows = $("#purchase-order-table").bootstrapTable('getSelections');
|
||||
|
||||
@ -182,6 +182,7 @@ $("#order-print").click(function() {
|
||||
|
||||
printPurchaseOrderReports(orders);
|
||||
})
|
||||
{% endif %}
|
||||
|
||||
$("#po-create").click(function() {
|
||||
createPurchaseOrder();
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
{% block thumbnail %}
|
||||
<img class='part-thumb'
|
||||
{% if order.customer.image %}
|
||||
{% if order.customer and order.customer.image %}
|
||||
src="{{ order.customer.image.url }}"
|
||||
{% else %}
|
||||
src="{% static 'img/blank_image.png' %}"
|
||||
@ -39,7 +39,9 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<span class='fas fa-print'></span> <span class='caret'></span>
|
||||
</button>
|
||||
<ul class='dropdown-menu' role='menu'>
|
||||
{% if report_enabled %}
|
||||
<li><a class='dropdown-item' href='#' id='print-order-report'><span class='fas fa-file-pdf'></span> {% trans "Print sales order report" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a class='dropdown-item' href='#' id='export-order'><span class='fas fa-file-download'></span> {% trans "Export order to file" %}</a></li>
|
||||
<!--
|
||||
<li><a class='dropdown-item' href='#' id='print-packing-list'><span class='fas fa-clipboard-list'></span>{% trans "Print packing list" %}</a></li>
|
||||
@ -106,11 +108,13 @@ src="{% static 'img/blank_image.png' %}"
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if order.customer %}
|
||||
<tr>
|
||||
<td><span class='fas fa-building'></span></td>
|
||||
<td>{% trans "Customer" %}</td>
|
||||
<td><a href="{% url 'company-detail' order.customer.id %}">{{ order.customer.name }}</a>{% include "clip.html"%}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.customer_reference %}
|
||||
<tr>
|
||||
<td><span class='fas fa-hashtag'></span></td>
|
||||
@ -128,7 +132,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Created" %}</td>
|
||||
<td>{{ order.creation_date }}<span class='badge'>{{ order.created_by }}</span></td>
|
||||
<td>{{ order.creation_date }}<span class='badge badge-right rounded-pill bg-dark'>{{ order.created_by }}</span></td>
|
||||
</tr>
|
||||
{% if order.target_date %}
|
||||
<tr>
|
||||
@ -141,14 +145,14 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-truck'></span></td>
|
||||
<td>{% trans "Shipped" %}</td>
|
||||
<td>{{ order.shipment_date }}<span class='badge'>{{ order.shipped_by }}</span></td>
|
||||
<td>{{ order.shipment_date }}<span class='badge badge-right rounded-pill bg-dark'>{{ order.shipped_by }}</span></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.status == PurchaseOrderStatus.COMPLETE %}
|
||||
<tr>
|
||||
<td><span class='fas fa-calendar-alt'></span></td>
|
||||
<td>{% trans "Received" %}</td>
|
||||
<td>{{ order.complete_date }}<span class='badge'>{{ order.received_by }}</span></td>
|
||||
<td>{{ order.complete_date }}<span class='badge badge-right rounded-pill bg-dark'>{{ order.received_by }}</span></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if order.responsible %}
|
||||
@ -204,9 +208,11 @@ $("#ship-order").click(function() {
|
||||
});
|
||||
});
|
||||
|
||||
{% if report_enabled %}
|
||||
$('#print-order-report').click(function() {
|
||||
printSalesOrderReports([{{ order.pk }}]);
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
$('#export-order').click(function() {
|
||||
exportOrder('{% url "so-export" order.id %}');
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
<div class='panel panel-hidden' id='panel-order-items'>
|
||||
<div class='panel-heading'>
|
||||
<div class='d-flex flex-row'>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Sales Order Items" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
@ -29,8 +29,7 @@
|
||||
<div class='panel-content'>
|
||||
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
|
||||
<div class='btn-group'>
|
||||
<div class='filter-list' id='filter-list-sales-order-lines'>
|
||||
</div>
|
||||
{% include "filter_list.html" with id="sales-order-lines" %}
|
||||
</div>
|
||||
</div>
|
||||
<table class='table table-striped table-condensed' id='so-lines-table' data-toolbar='#order-toolbar-buttons'>
|
||||
@ -78,7 +77,7 @@
|
||||
|
||||
<div class='panel panel-hidden' id='panel-order-attachments'>
|
||||
<div class='panel-heading'>
|
||||
<div class='d-flex flex-row'>
|
||||
<div class='d-flex flex-wrap'>
|
||||
<h4>{% trans "Attachments" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
|
@ -29,19 +29,18 @@
|
||||
<div id='table-buttons'>
|
||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||
<div class='btn-group'>
|
||||
|
||||
{% if report_enabled %}
|
||||
<button id='order-print' class='btn btn-outline-secondary' title='{% trans "Print Order Reports" %}'>
|
||||
<span class='fas fa-print'></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
<button class='btn btn-outline-secondary' type='button' id='view-calendar' title='{% trans "Display calendar view" %}'>
|
||||
<span class='fas fa-calendar-alt'></span>
|
||||
</button>
|
||||
<button class='btn btn-outline-secondary' type='button' id='view-list' title='{% trans "Display list view" %}'>
|
||||
<span class='fas fa-th-list'></span>
|
||||
</button>
|
||||
<div class='filter-list' id='filter-list-salesorder'>
|
||||
<!-- An empty div in which the filter list will be constructed -->
|
||||
</div>
|
||||
{% include "filter_list.html" with id="salesorder" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -175,6 +174,7 @@ loadSalesOrderTable("#sales-order-table", {
|
||||
url: "{% url 'api-so-list' %}",
|
||||
});
|
||||
|
||||
{% if report_enabled %}
|
||||
$("#order-print").click(function() {
|
||||
var rows = $("#sales-order-table").bootstrapTable('getSelections');
|
||||
|
||||
@ -186,6 +186,7 @@ $("#order-print").click(function() {
|
||||
|
||||
printSalesOrderReports(orders);
|
||||
})
|
||||
{% endif %}
|
||||
|
||||
$("#so-create").click(function() {
|
||||
createSalesOrder();
|
||||
|
@ -350,6 +350,31 @@ class PurchaseOrderReceiveTest(OrderTest):
|
||||
# No new stock items have been created
|
||||
self.assertEqual(self.n, StockItem.objects.count())
|
||||
|
||||
def test_null_barcode(self):
|
||||
"""
|
||||
Test than a "null" barcode field can be provided
|
||||
"""
|
||||
|
||||
# Set stock item barcode
|
||||
item = StockItem.objects.get(pk=1)
|
||||
item.save()
|
||||
|
||||
# Test with "null" value
|
||||
self.post(
|
||||
self.url,
|
||||
{
|
||||
'items': [
|
||||
{
|
||||
'line_item': 1,
|
||||
'quantity': 50,
|
||||
'barcode': None,
|
||||
}
|
||||
],
|
||||
'location': 1,
|
||||
},
|
||||
expected_code=201
|
||||
)
|
||||
|
||||
def test_invalid_barcodes(self):
|
||||
"""
|
||||
Tests for checking in items with invalid barcodes:
|
||||
|
Reference in New Issue
Block a user