Index: trunk/grails-app/views/inventoryItemPurchaseDetailed/create.gsp
===================================================================
--- trunk/grails-app/views/inventoryItemPurchaseDetailed/create.gsp	(revision 620)
+++ trunk/grails-app/views/inventoryItemPurchaseDetailed/create.gsp	(revision 633)
@@ -15,4 +15,10 @@
         <div class="body">
             <g:render template="/shared/messages" />
+            <g:if test="${!costCodes}" >
+                <div class="errors">
+                    <ul>
+                        <li><g:message code="inventoryItemPurchase.costCodes.not.found" /><li>
+                </div>
+            </g:if>
             <g:hasErrors bean="${inventoryItemPurchaseInstance}">
             <div class="errors">
@@ -66,5 +72,5 @@
                                 <td valign="top" class="value ${hasErrors(bean:inventoryItemPurchaseInstance,field:'costCode','errors')}">
                                     <g:select optionKey="id"
-                                                        from="${ CostCode.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }"
+                                                        from="${ costCodes }"
                                                         name="costCode.id"
                                                         value="${inventoryItemPurchaseInstance?.costCode?.id}"
Index: trunk/grails-app/views/inventoryItemPurchaseDetailed/edit.gsp
===================================================================
--- trunk/grails-app/views/inventoryItemPurchaseDetailed/edit.gsp	(revision 620)
+++ trunk/grails-app/views/inventoryItemPurchaseDetailed/edit.gsp	(revision 633)
@@ -59,5 +59,5 @@
                                 </td>
                             </tr> 
-                        
+
                             <tr class="prop">
                                 <td valign="top" class="name">
@@ -65,9 +65,16 @@
                                 </td>
                                 <td valign="top" class="value ${hasErrors(bean:inventoryItemPurchaseInstance,field:'costCode','errors')}">
-                                    <g:select optionKey="id"
-                                                        from="${ CostCode.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }"
-                                                        name="costCode.id"
-                                                        value="${inventoryItemPurchaseInstance?.costCode?.id}" >
-                                    </g:select>
+                                    <g:if test="${costCodes}">
+                                        <g:select optionKey="id"
+                                                            from="${ costCodes }"
+                                                            name="costCode.id"
+                                                            value="${inventoryItemPurchaseInstance.costCode?.id}" >
+                                        </g:select>
+                                    </g:if>
+                                    <g:else>
+                                        <g:link controller="costCodeDetailed" action="show" id="${inventoryItemPurchaseInstance?.costCode?.id}">
+                                            ${inventoryItemPurchaseInstance?.costCode?.encodeAsHTML()}
+                                        </g:link>
+                                    </g:else>
                                     <g:helpBalloon code="inventoryItemPurchase.cost.code" />
                                 </td>
@@ -96,6 +103,5 @@
                                                         from="${ Supplier.findAllByIsActive(true).sort { p1, p2 -> p1.name.compareToIgnoreCase(p2.name) } }"
                                                         name="supplier.id"
-                                                        value="${inventoryItemPurchaseInstance?.supplier?.id}"
-                                                        noSelection="['null':/${g.message(code:'default.please.select.text')}/]">
+                                                        value="${inventoryItemPurchaseInstance?.supplier?.id}">
                                     </g:select>
                                     <g:helpBalloon code="inventoryItemPurchase.supplier" />
