mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Some PEP fixes
This commit is contained in:
		| @@ -812,7 +812,7 @@ class PurchaseOrderLineItem(OrderLineItem): | ||||
|     def get_destination(self): | ||||
|         """ | ||||
|         Show where the line item is or should be placed | ||||
|          | ||||
|  | ||||
|         NOTE: If a line item gets split when recieved, only an arbitrary | ||||
|               stock items location will be reported as the location for the | ||||
|               entire line. | ||||
| @@ -993,7 +993,7 @@ class SalesOrderShipment(models.Model): | ||||
|         if self.shipment_date: | ||||
|             # Shipment has already been sent! | ||||
|             raise ValidationError(_("Shipment has already been sent")) | ||||
|   | ||||
|  | ||||
|         if self.allocations.count() == 0: | ||||
|             raise ValidationError(_("Shipment has no allocated stock items")) | ||||
|  | ||||
| @@ -1014,11 +1014,10 @@ class SalesOrderShipment(models.Model): | ||||
|  | ||||
|         # Iterate through each stock item assigned to this shipment | ||||
|         for allocation in allocations: | ||||
|              | ||||
|             # Mark the allocation as "complete" | ||||
|             allocation.complete_allocation(user) | ||||
|  | ||||
|         # Update the "shipment" date  | ||||
|         # Update the "shipment" date | ||||
|         self.shipment_date = datetime.now() | ||||
|         self.shipped_by = user | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,7 @@ from django.core.exceptions import ValidationError as DjangoValidationError | ||||
| from django.db import models, transaction | ||||
| from django.db.models import Case, When, Value | ||||
| from django.db.models import BooleanField, ExpressionWrapper, F | ||||
| from InvenTree.InvenTree.status_codes import SalesOrderStatus | ||||
|  | ||||
| from rest_framework import serializers | ||||
| from rest_framework.serializers import ValidationError | ||||
| @@ -653,7 +654,7 @@ class SalesOrderShipmentCompleteSerializer(serializers.ModelSerializer): | ||||
|             return | ||||
|  | ||||
|         data = self.validated_data | ||||
|          | ||||
|  | ||||
|         request = self.context['request'] | ||||
|         user = request.user | ||||
|  | ||||
| @@ -748,7 +749,9 @@ class SalesOrderCompleteSerializer(serializers.Serializer): | ||||
|         order = self.context['order'] | ||||
|         data = self.validated_data | ||||
|  | ||||
|          | ||||
|         # Mark this order as complete! | ||||
|         order.status = SalesOrderStatus.SHIPPED | ||||
|         order.save() | ||||
|  | ||||
|  | ||||
| class SOShipmentAllocationSerializer(serializers.Serializer): | ||||
| @@ -816,7 +819,6 @@ class SOShipmentAllocationSerializer(serializers.Serializer): | ||||
|  | ||||
|         with transaction.atomic(): | ||||
|             for entry in items: | ||||
|                  | ||||
|                 # Create a new SalesOrderAllocation | ||||
|                 order.models.SalesOrderAllocation.objects.create( | ||||
|                     line=entry.get('line_item'), | ||||
|   | ||||
| @@ -111,7 +111,7 @@ class TestShipmentMigration(MigratorTestCase): | ||||
|         # The "shipment" model does not exist yet | ||||
|         with self.assertRaises(LookupError): | ||||
|             self.old_state.apps.get_model('order', 'salesordershipment') | ||||
|      | ||||
|  | ||||
|     def test_shipment_creation(self): | ||||
|         """ | ||||
|         Check that a SalesOrderShipment has been created | ||||
|   | ||||
| @@ -10,7 +10,7 @@ from company.models import Company | ||||
|  | ||||
| from InvenTree import status_codes as status | ||||
|  | ||||
| from order.models import SalesOrder, SalesOrderLineItem, SalesOrderShipment, SalesOrderAllocation | ||||
| from order.models import SalesOrder, SalesOrderLineItem, SalesOrderAllocation | ||||
|  | ||||
| from part.models import Part | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user