question: public static boolean isInvoiceType ( GenericValue invoice , String inputTypeId ) throws GenericEntityException { if ( invoice == null ) { return false ; } GenericValue invoiceType = invoice . getRelatedOne ( "InvoiceType" , true ) ; if ( invoiceType == null ) { throw new GenericEntityException ( "Cannot find InvoiceType for invoiceId " + invoice . getString ( "invoiceId" ) ) ; } String invoiceTypeId = invoiceType . getString ( "invoiceTypeId" ) ; if ( inputTypeId . equals ( invoiceTypeId ) ) { return true ; } return isInvoiceTypeRecurse ( invoiceType , inputTypeId ) ; }
target:  Checks if a invoice is of a specified InvoiceType.invoiceTypeId. Return false if invoice is null. It's better to use more specific calls like isPurchaseInvoice().