Changeset 964 for trunk/grails-app/services/InventoryPurchaseService.groovy
- Timestamp:
- Jul 19, 2012, 1:35:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/InventoryPurchaseService.groovy
r717 r964 194 194 } 195 195 196 def movementResult = inventoryMovementService.reverseMove(inventoryMovements[0]) 197 if(movementResult.error) 198 return fail(code:"inventoryMovement.quantity.insufficientItemsInStock") 196 if(inventoryMovements[0]) { 197 def movementResult = inventoryMovementService.reverseMove(inventoryMovements[0]) 198 if(movementResult.error) 199 return fail(code:"inventoryItemPurchase.delete.failure.reverse.move") 200 } 199 201 200 202 InventoryItemPurchase.withCriteria { … … 213 215 // Deletion of received already requires payment approved to be deleted. 214 216 if(purchaseTypeId == 1) { 217 215 218 def calcQuantities = calcQuantities(result.inventoryItemPurchaseInstance) 216 219 if(calcQuantities.totalReceived > 0) 220 return fail(code:"inventoryItemPurchase.delete.failure.received.exists") 221 222 // Cover the case of 0 ordered and received. 223 // Only possible to have Received Complete (3L) in this case and not B/order (2L). 224 def receivedExists = InventoryItemPurchase.withCriteria { 225 eq("inventoryItem", result.inventoryItemPurchaseInstance.inventoryItem) 226 eq("purchaseOrderNumber", result.inventoryItemPurchaseInstance.purchaseOrderNumber) 227 inventoryItemPurchaseType { 228 eq("id", 3L) // Received Complete. 229 } 230 } 231 232 if(receivedExists) 217 233 return fail(code:"inventoryItemPurchase.delete.failure.received.exists") 218 234 }
Note: See TracChangeset
for help on using the changeset viewer.