Search in sources :

Example 31 with BankOrder

use of com.axelor.apps.bankpayment.db.BankOrder in project axelor-open-suite by axelor.

the class BankOrderLineController method setBankDetailsDomain.

// settings the domain for the bank details view.
public void setBankDetailsDomain(ActionRequest request, ActionResponse response) {
    BankOrderLine bankOrderLine = request.getContext().asType(BankOrderLine.class);
    BankOrder bankOrder = request.getContext().getParent().asType(BankOrder.class);
    String domain = Beans.get(BankOrderLineService.class).createDomainForBankDetails(bankOrderLine, bankOrder);
    // if nothing was found for the domain, we set it at a default value.
    if (domain.equals("")) {
        response.setAttr("receiverBankDetails", "domain", "self.id IN (0)");
    } else {
        response.setAttr("receiverBankDetails", "domain", domain);
    }
}
Also used : BankOrderLineService(com.axelor.apps.bankpayment.service.bankorder.BankOrderLineService) BankOrderLine(com.axelor.apps.bankpayment.db.BankOrderLine) BankOrder(com.axelor.apps.bankpayment.db.BankOrder)

Example 32 with BankOrder

use of com.axelor.apps.bankpayment.db.BankOrder in project axelor-open-suite by axelor.

the class InvoicePaymentCancelServiceBankPayImpl method cancel.

/**
 * Method to cancel an invoice Payment
 *
 * <p>Cancel the eventual Move and Reconcile Compute the total amount paid on the linked invoice
 * Change the status to cancel
 *
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 */
@Override
@Transactional(rollbackOn = { Exception.class })
public void cancel(InvoicePayment invoicePayment) throws AxelorException {
    if (!Beans.get(AppBankPaymentService.class).isApp("bank-payment")) {
        super.cancel(invoicePayment);
        return;
    }
    BankOrder paymentBankOrder = invoicePayment.getBankOrder();
    if (paymentBankOrder != null) {
        if (paymentBankOrder.getStatusSelect() == BankOrderRepository.STATUS_CARRIED_OUT || paymentBankOrder.getStatusSelect() == BankOrderRepository.STATUS_REJECTED) {
            throw new AxelorException(invoicePayment, TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.INVOICE_PAYMENT_CANCEL));
        } else if (paymentBankOrder.getStatusSelect() != BankOrderRepository.STATUS_CANCELED) {
            bankOrderService.cancelBankOrder(paymentBankOrder);
            this.updateCancelStatus(invoicePayment);
        }
    }
    super.cancel(invoicePayment);
}
Also used : AxelorException(com.axelor.exception.AxelorException) BankOrder(com.axelor.apps.bankpayment.db.BankOrder) Transactional(com.google.inject.persist.Transactional)

Example 33 with BankOrder

use of com.axelor.apps.bankpayment.db.BankOrder in project axelor-open-suite by axelor.

the class InvoicePaymentValidateServiceBankPayImpl method createBankOrder.

/**
 * Method to create a bank order for an invoice Payment
 *
 * @param invoicePayment An invoice payment
 * @throws AxelorException
 * @throws DatatypeConfigurationException
 * @throws IOException
 * @throws JAXBException
 */
@Transactional(rollbackOn = { Exception.class })
public void createBankOrder(InvoicePayment invoicePayment) throws AxelorException, JAXBException, IOException, DatatypeConfigurationException {
    BankOrder bankOrder = bankOrderCreateService.createBankOrder(invoicePayment);
    if (invoicePayment.getPaymentMode().getAutoConfirmBankOrder()) {
        bankOrderService.confirm(bankOrder);
    }
    invoicePayment.setBankOrder(bankOrder);
    invoicePaymentRepository.save(invoicePayment);
}
Also used : BankOrder(com.axelor.apps.bankpayment.db.BankOrder) Transactional(com.google.inject.persist.Transactional)

Aggregations

BankOrder (com.axelor.apps.bankpayment.db.BankOrder)33 AxelorException (com.axelor.exception.AxelorException)16 Transactional (com.google.inject.persist.Transactional)11 BankOrderService (com.axelor.apps.bankpayment.service.bankorder.BankOrderService)10 BankOrderLine (com.axelor.apps.bankpayment.db.BankOrderLine)8 PaymentMode (com.axelor.apps.account.db.PaymentMode)6 BankDetails (com.axelor.apps.base.db.BankDetails)6 LocalDate (java.time.LocalDate)6 Company (com.axelor.apps.base.db.Company)4 Currency (com.axelor.apps.base.db.Currency)4 InvoicePayment (com.axelor.apps.account.db.InvoicePayment)3 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)3 Partner (com.axelor.apps.base.db.Partner)3 BigDecimal (java.math.BigDecimal)3 ArrayList (java.util.ArrayList)3 AccountingBatch (com.axelor.apps.account.db.AccountingBatch)2 PaymentScheduleLine (com.axelor.apps.account.db.PaymentScheduleLine)2 BankOrderRepository (com.axelor.apps.bankpayment.db.repo.BankOrderRepository)2 BankOrderLineService (com.axelor.apps.bankpayment.service.bankorder.BankOrderLineService)2 BankOrderMergeService (com.axelor.apps.bankpayment.service.bankorder.BankOrderMergeService)2