
/**
 * Created by IntelliJ IDEA.
 * User: John
 * Date: 18/04/2011
 * Time: 3:01:53 PM
 * To change this template use File | Settings | File Templates.
 */
class PurchaseOrderNumber {
    String value
    PurchaseOrder purchaseOrder

    static transients = ['description']

    static constraints = {
        purchaseOrder(nullable:true)
    }

    String getDescription() {
        if (!purchaseOrder) {
        return value + " - new"
        } else {
            return "${value} for ${purchaseOrder.supplier}"
        }
    }
}
