Search in sources :

Example 41 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class ProjectInvoicingAssistantBatchController method showRecords.

private void showRecords(ActionRequest request, ActionResponse response, Map<String, Object> values) throws ClassNotFoundException {
    Batch batch = request.getContext().asType(Batch.class);
    batch = Beans.get(BatchRepository.class).find(batch.getId());
    String ids = Beans.get(ProjectInvoicingAssistantBatchService.class).getShowRecordIds(batch, values.get("field").toString());
    response.setView(ActionView.define(values.get("title").toString()).model(values.get("model").toString()).add("grid", values.get("grid").toString()).add("form", values.get("form").toString()).domain("self.id IN (" + ids + ")").map());
}
Also used : Batch(com.axelor.apps.base.db.Batch) ProjectInvoicingAssistantBatch(com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch) ProjectInvoicingAssistantBatchService(com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)

Example 42 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class ProductionBatchService method run.

@Override
public Batch run(Model model) throws AxelorException {
    Batch batch;
    ProductionBatch productionBatch = (ProductionBatch) model;
    switch(productionBatch.getActionSelect()) {
        case ProductionBatchRepository.ACTION_COMPUTE_WORK_IN_PROGRESS_VALUATION:
            batch = computeValuation(productionBatch);
            break;
        default:
            throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), productionBatch.getActionSelect(), productionBatch.getCode());
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) ProductionBatch(com.axelor.apps.production.db.ProductionBatch) Batch(com.axelor.apps.base.db.Batch) ProductionBatch(com.axelor.apps.production.db.ProductionBatch)

Example 43 with Batch

use of com.axelor.apps.base.db.Batch in project axelor-open-suite by axelor.

the class InvoiceBatchService method run.

/**
 * Lancer un batch à partir de son code.
 *
 * @param batchCode Le code du batch souhaité.
 * @throws AxelorException
 */
public Batch run(String batchCode) throws AxelorException {
    Batch batch;
    InvoiceBatch invoiceBatch = invoiceBatchRepo.findByCode(batchCode);
    if (invoiceBatch != null) {
        switch(invoiceBatch.getActionSelect()) {
            case InvoiceBatchRepository.BATCH_STATUS:
                batch = wkf(invoiceBatch);
                break;
            default:
                throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_1), invoiceBatch.getActionSelect(), batchCode);
        }
    } else {
        throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.BASE_BATCH_2), batchCode);
    }
    return batch;
}
Also used : AxelorException(com.axelor.exception.AxelorException) InvoiceBatch(com.axelor.apps.account.db.InvoiceBatch) Batch(com.axelor.apps.base.db.Batch) InvoiceBatch(com.axelor.apps.account.db.InvoiceBatch)

Aggregations

Batch (com.axelor.apps.base.db.Batch)43 AccountingBatch (com.axelor.apps.account.db.AccountingBatch)12 AxelorException (com.axelor.exception.AxelorException)12 AccountingBatchService (com.axelor.apps.account.service.batch.AccountingBatchService)6 AccountingBatchRepository (com.axelor.apps.account.db.repo.AccountingBatchRepository)5 HashMap (java.util.HashMap)5 CrmBatch (com.axelor.apps.crm.db.CrmBatch)4 InvoiceBatch (com.axelor.apps.account.db.InvoiceBatch)3 BankPaymentBatch (com.axelor.apps.bankpayment.db.BankPaymentBatch)3 ProjectInvoicingAssistantBatch (com.axelor.apps.businessproject.db.ProjectInvoicingAssistantBatch)3 CrmBatchService (com.axelor.apps.crm.service.batch.CrmBatchService)3 SupplychainBatch (com.axelor.apps.supplychain.db.SupplychainBatch)3 SupplychainBatchService (com.axelor.apps.supplychain.service.batch.SupplychainBatchService)3 InvoiceBatchService (com.axelor.apps.account.service.invoice.InvoiceBatchService)2 BaseBatch (com.axelor.apps.base.db.BaseBatch)2 MailBatch (com.axelor.apps.base.db.MailBatch)2 MailBatchRepository (com.axelor.apps.base.db.repo.MailBatchRepository)2 ProjectInvoicingAssistantBatchService (com.axelor.apps.businessproject.service.batch.ProjectInvoicingAssistantBatchService)2 Account (com.axelor.apps.account.db.Account)1 AccountConfig (com.axelor.apps.account.db.AccountConfig)1