mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 12:36:45 +00:00
Clear allocations when manually returning an item into stock from a customer (#8298)
This commit is contained in:
parent
d59994ea75
commit
181e1dd9cc
@ -2328,7 +2328,7 @@ class ReturnOrder(TotalPriceMixin, Order):
|
|||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def receive_line_item(self, line, location, user, note=''):
|
def receive_line_item(self, line, location, user, note='', **kwargs):
|
||||||
"""Receive a line item against this ReturnOrder.
|
"""Receive a line item against this ReturnOrder.
|
||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
@ -2354,7 +2354,7 @@ class ReturnOrder(TotalPriceMixin, Order):
|
|||||||
deltas['customer'] = stock_item.customer.pk
|
deltas['customer'] = stock_item.customer.pk
|
||||||
|
|
||||||
# Update the StockItem
|
# Update the StockItem
|
||||||
stock_item.status = StockStatus.QUARANTINED.value
|
stock_item.status = kwargs.get('status', StockStatus.QUARANTINED.value)
|
||||||
stock_item.location = location
|
stock_item.location = location
|
||||||
stock_item.customer = None
|
stock_item.customer = None
|
||||||
stock_item.sales_order = None
|
stock_item.sales_order = None
|
||||||
|
@ -1238,10 +1238,12 @@ class StockItem(
|
|||||||
location=location,
|
location=location,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Clear out allocation information for the stock item
|
||||||
self.customer = None
|
self.customer = None
|
||||||
self.belongs_to = None
|
self.belongs_to = None
|
||||||
self.sales_order = None
|
self.sales_order = None
|
||||||
self.location = location
|
self.location = location
|
||||||
|
self.clearAllocations()
|
||||||
|
|
||||||
trigger_event('stockitem.returnedfromcustomer', id=self.id)
|
trigger_event('stockitem.returnedfromcustomer', id=self.id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user