- Timestamp:
- Apr 21, 2011, 3:29:47 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/features/purchaseOrders/grails-app/domain/InventoryItemPurchase.groovy
r609 r891 14 14 15 15 Integer quantity 16 String purchaseOrderNumber = ''16 PurchaseOrder purchaseOrder 17 17 BigDecimal orderValueAmount 18 18 Currency orderValueCurrency … … 25 25 // hasMany = [] 26 26 27 static belongsTo = [InventoryItem ]27 static belongsTo = [InventoryItem, PurchaseOrder] 28 28 29 29 static constraints = { 30 30 quantity(min:0) 31 purchaseOrderNumber(blank:false, maxSize:50, validator: {val, obj ->32 // For orders the purchaseOrderNumber must be unique for an inventoryItem.33 if(obj.inventoryItemPurchaseType.id == 1L) {34 def list = InventoryItemPurchase.withCriteria {35 eq('inventoryItem', obj.inventoryItem)36 eq('purchaseOrderNumber', obj.purchaseOrderNumber)37 eq('inventoryItemPurchaseType', obj.inventoryItemPurchaseType)38 if(obj.id)39 notEqual('id', obj.id)40 }41 if(list.size() > 0)42 return 'not.unique.for.inventory.item.order'43 }44 // Success.45 return true46 })31 // purchaseOrderNumber(blank:false, maxSize:50, validator: {val, obj -> 32 // // For orders the purchaseOrderNumber must be unique for an inventoryItem. 33 // if(obj.inventoryItemPurchaseType.id == 1L) { 34 // def list = InventoryItemPurchase.withCriteria { 35 // eq('inventoryItem', obj.inventoryItem) 36 // eq('purchaseOrderNumber', obj.purchaseOrderNumber) 37 // eq('inventoryItemPurchaseType', obj.inventoryItemPurchaseType) 38 // if(obj.id) 39 // notEqual('id', obj.id) 40 // } 41 // if(list.size() > 0) 42 // return 'not.unique.for.inventory.item.order' 43 // } 44 // // Success. 45 // return true 46 // }) 47 47 invoiceNumber(maxSize:50) 48 48 orderValueAmount(max: new BigDecimal(1000000000000)) … … 56 56 } 57 57 58 static transients = [ 'purchaseOrderNumber' ] 59 60 String getPurchaseOrderNumber() { 61 return purchaseOrder?.purchaseOrderNumber?.value 62 } 58 63 }
Note: See TracChangeset
for help on using the changeset viewer.