Fix:
Update in purchase/return would give wrong product changed error when a product was deleted as the id of the inventory was not checked properly
This commit is contained in:
parent
4685fa2528
commit
40e79ff949
@ -177,7 +177,7 @@ def update_inventory(voucher: Voucher, new_inventories: List[schema_in.Inventory
|
||||
found = False
|
||||
for j in range(len(new_inventories), 0, -1):
|
||||
new_inventory = new_inventories[j - 1]
|
||||
if new_inventory.id_:
|
||||
if new_inventory.id_ == item.id:
|
||||
product = db.query(Product).filter(Product.id == new_inventory.product.id_).first()
|
||||
found = True
|
||||
if item.product_id != new_inventory.product.id_:
|
||||
|
@ -173,7 +173,7 @@ def update_inventory(voucher: Voucher, new_inventories: List[schema_in.Inventory
|
||||
found = False
|
||||
for j in range(len(new_inventories), 0, -1):
|
||||
new_inventory = new_inventories[j - 1]
|
||||
if new_inventory.id_:
|
||||
if new_inventory.id_ == item.id:
|
||||
found = True
|
||||
if item.product_id != new_inventory.product.id_:
|
||||
raise HTTPException(
|
||||
|
Loading…
x
Reference in New Issue
Block a user