From 3c5ba75d27d42a96b1ce7c14da4ad5e2b2e58fa0 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 26 Apr 2020 16:44:35 +1000 Subject: [PATCH] PEP fixes --- InvenTree/build/models.py | 3 +++ InvenTree/order/models.py | 3 +++ InvenTree/stock/admin.py | 2 +- .../stock/templates/stock/item_base.html | 23 +++++-------------- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 893f9ed439..11694299af 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -265,6 +265,9 @@ class Build(MPTTModel): for build_item in self.allocated_stock.all().prefetch_related('stock_item'): build_item.complete_allocation(user) + # TODO - Remove the builditem from the database + # build_item.delete() + notes = 'Built {q} on {now}'.format( q=self.quantity, now=str(datetime.now().date()) diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index 2869b227a1..a4501bd9eb 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -324,6 +324,9 @@ class SalesOrder(Order): for allocation in line.allocations.all(): allocation.complete_allocation(user) + # TODO - Remove the allocation from the database + # allocation.delete() + # Ensure the order status is marked as "Shipped" self.status = SalesOrderStatus.SHIPPED self.shipment_date = datetime.now().date() diff --git a/InvenTree/stock/admin.py b/InvenTree/stock/admin.py index 193e807b7f..e233908ec7 100644 --- a/InvenTree/stock/admin.py +++ b/InvenTree/stock/admin.py @@ -12,7 +12,7 @@ from .models import StockLocation, StockItem from .models import StockItemTracking from build.models import Build -from company.models import Company, SupplierPart +from company.models import SupplierPart from order.models import PurchaseOrder, SalesOrder from part.models import Part diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index bb209f309c..25f582a27c 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -15,16 +15,6 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% block pre_content %} {% include 'stock/loc_link.html' with location=item.location %} -{% if item.sales_order %} -
- {% trans "This stock item was assigned to" %} {% trans "Sales Order" %} {{ item.sales_order.id }} -
-{% elif item.build_order %} -
- {% trans "This stock item was assigned to" %} {% trans "Build Order" %} #{{ item.build_order.id }} -
-{% else %} - {% for allocation in item.sales_order_allocations.all %}
{% trans "This stock item is allocated to Sales Order" %} #{{ allocation.line.order.reference }} ({% trans "Quantity" %}: {% decimal allocation.quantity %}) @@ -36,7 +26,6 @@ InvenTree | {% trans "Stock Item" %} - {{ item }} {% trans "This stock item is allocated to Build" %} #{{ allocation.build.id }} ({% trans "Quantity" %}: {% decimal allocation.quantity %})
{% endfor %} -{% endif %} {% if item.serialized %}
@@ -62,13 +51,13 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}

{% trans "Stock Item" %} {% if item.sales_order %} -
- {% trans "Sold" $} -
+ +
{% trans "Sold" $}
+
{% elif item.build_order %} -
- {% trans "Used in Build" %} -
+ +
{% trans "Used in Build" %}
+
{% elif item.status in StockStatus.UNAVAILABLE_CODES %}{% stock_status_label item.status large=True %} {% endif %}