Search in sources :

Example 1 with I_C_Invoice_Candidate

use of de.metas.invoicecandidate.model.I_C_Invoice_Candidate in project metasfresh-webui-api by metasfresh.

the class C_Invoice_Candidate_ApproveForInvoicing method retrieveInvoiceCandidatesToApproveQuery.

private final IQuery<I_C_Invoice_Candidate> retrieveInvoiceCandidatesToApproveQuery() {
    final IQueryBuilder<I_C_Invoice_Candidate> queryBuilder = Services.get(IQueryBL.class).createQueryBuilder(I_C_Invoice_Candidate.class).filter(getProcessInfo().getQueryFilter()).addOnlyActiveRecordsFilter().addNotEqualsFilter(I_C_Invoice_Candidate.COLUMN_Processed, // not processed
    true).addNotEqualsFilter(I_C_Invoice_Candidate.COLUMN_ApprovalForInvoicing, // not already approved
    true);
    // Only selected rows
    final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
    if (!selectedRowIds.isAll()) {
        final Set<Integer> invoiceCandidateIds = selectedRowIds.toIntSet();
        if (invoiceCandidateIds.isEmpty()) {
            // shall not happen
            throw new AdempiereException("@NoSelection@");
        }
        queryBuilder.addInArrayFilter(I_C_Invoice_Candidate.COLUMN_C_Invoice_Candidate_ID, invoiceCandidateIds);
    }
    return queryBuilder.create();
}
Also used : IQueryBL(org.adempiere.ad.dao.IQueryBL) AdempiereException(org.adempiere.exceptions.AdempiereException) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) I_C_Invoice_Candidate(de.metas.invoicecandidate.model.I_C_Invoice_Candidate)

Aggregations

I_C_Invoice_Candidate (de.metas.invoicecandidate.model.I_C_Invoice_Candidate)1 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)1 IQueryBL (org.adempiere.ad.dao.IQueryBL)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1