2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

"Fixes" for completing a build

- This will require a lot of unit testing to get right
This commit is contained in:
Oliver Walters
2020-04-26 00:32:09 +10:00
parent 72c43d0c2d
commit 0892b160c6
6 changed files with 85 additions and 29 deletions

View File

@ -25,7 +25,7 @@ from company.models import Company, SupplierPart
from InvenTree.fields import RoundingDecimalField
from InvenTree.helpers import decimal2string, normalize
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus
from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus, StockStatus
from InvenTree.models import InvenTreeAttachment
@ -574,12 +574,15 @@ class SalesOrderAllocation(models.Model):
# Grab a copy of the new stock item (which will keep track of its "parent")
item = item.splitStock(self.quantity, None, user)
# Update our own reference to the new item
self.item = item
self.save()
# Assign the StockItem to the SalesOrder customer
item.customer = self.line.order.customer
# Clear the location
item.location = None
item.status = StockStatus.SENT_TO_CUSTOMER
item.save()
print("Finalizing allocation for: " + str(self.item))