Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix 0.7.8 #141

Merged
merged 8 commits into from
Apr 28, 2016
Prev Previous commit
Next Next commit
fixed #50: Illegal attempt to associate a collection with two open se…
…ssions when receiving against purchase order
  • Loading branch information
jmiranda committed Apr 22, 2016
commit f0eafbe24ce525f0f7e2aa91091a5535f0be6edf
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ class InventoryService implements ApplicationContextAware {
inventoryItem.lotNumber = lotNumber
inventoryItem.expirationDate = expirationDate;
inventoryItem.product = product
inventoryItem.save()
inventoryItem.save(flush:true)
}
return inventoryItem

Expand Down
10 changes: 6 additions & 4 deletions grails-app/services/org/pih/warehouse/order/OrderService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ class OrderService {
// Find or create a new inventory item based on the product and lot number provided
def inventoryItem = null

// Need to use new session here otherwise it flushes the current session and causes an error
InventoryItem.withNewSession {
inventoryItem = inventoryService.findOrCreateInventoryItem(orderItemCommand.productReceived, orderItemCommand.lotNumber, orderItemCommand.expirationDate)
}
// Need to use withSession here otherwise it flushes the current session and causes an error
InventoryItem.withSession { session ->
inventoryItem = inventoryService.findOrCreateInventoryItem(orderItemCommand.productReceived, orderItemCommand.lotNumber, orderItemCommand.expirationDate)
session.flush()
session.clear()
}

def shipmentItem = new ShipmentItem();
shipmentItem.lotNumber = orderItemCommand.lotNumber
Expand Down