- Timestamp:
- Feb 23, 2010, 10:19:44 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/InventoryMovementDetailedController.groovy
r298 r406 54 54 if(!result.error) { 55 55 flash.message = "InventoryMovement ${params.id} deleted" 56 redirect(controller:"taskDetailed", action:"show", id:result.taskId) 56 if(result.taskId) 57 redirect(controller:"taskDetailed", action:"show", id:result.taskId) 58 redirect(controller:"inventoryItemDetailed", action:"show", id:result.inventoryItemInstance?.id) 57 59 } 58 60 else { -
trunk/grails-app/services/InventoryMovementService.groovy
r291 r406 30 30 } 31 31 32 def inventoryItem= InventoryItem.lock(result.inventoryMovementInstance.inventoryItem.id)32 result.inventoryItemInstance = InventoryItem.lock(result.inventoryMovementInstance.inventoryItem.id) 33 33 result.taskId = result.inventoryMovementInstance.task?.id 34 34 35 if(! inventoryItem) {35 if(!result.inventoryItemInstance) { 36 36 status.setRollbackOnly() 37 37 result.inventoryMovementInstance.errors.rejectValue('inventoryItem', "inventoryMovement.inventoryItem.notFound") … … 40 40 } 41 41 42 if(result.inventoryMovementInstance.task.taskStatus.id == 3) {43 status.setRollbackOnly()44 result.inventoryMovementInstance.errors.rejectValue('task', "task.operationNotPermittedOnCompleteTask")45 result.error = true46 return result47 }48 49 42 // Reverse the movement of inventory. 50 43 if(!result.inventoryMovementInstance.inventoryMovementType.incrementsInventory) { 51 inventoryItem.unitsInStock += result.inventoryMovementInstance.quantity44 result.inventoryItemInstance.unitsInStock += result.inventoryMovementInstance.quantity 52 45 } 53 46 else { 54 if( inventoryItem.unitsInStock >= result.inventoryMovementInstance.quantity) {55 inventoryItem.unitsInStock -= result.inventoryMovementInstance.quantity47 if(result.inventoryItemInstance.unitsInStock >= result.inventoryMovementInstance.quantity) { 48 result.inventoryItemInstance.unitsInStock -= result.inventoryMovementInstance.quantity 56 49 } 57 50 else { … … 63 56 } 64 57 65 if( inventoryItem.save() ) {58 if(result.inventoryItemInstance.save() ) { 66 59 // All went well if we get to this point. 67 60 result.inventoryMovementInstance.delete()
Note: See TracChangeset
for help on using the changeset viewer.