Search in sources :

Example 1 with InvoicePaymentToolService

use of com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentToolService in project axelor-open-suite by axelor.

the class InvoiceServiceImpl method getMoveLinesFromInvoiceAdvancePayments.

@Override
public List<MoveLine> getMoveLinesFromInvoiceAdvancePayments(Invoice invoice) {
    List<MoveLine> advancePaymentMoveLines = new ArrayList<>();
    Set<Invoice> advancePayments = invoice.getAdvancePaymentInvoiceSet();
    List<InvoicePayment> invoicePayments;
    if (advancePayments == null || advancePayments.isEmpty()) {
        return advancePaymentMoveLines;
    }
    InvoicePaymentToolService invoicePaymentToolService = Beans.get(InvoicePaymentToolService.class);
    for (Invoice advancePayment : advancePayments) {
        invoicePayments = advancePayment.getInvoicePaymentList();
        List<MoveLine> creditMoveLines = invoicePaymentToolService.getCreditMoveLinesFromPayments(invoicePayments);
        advancePaymentMoveLines.addAll(creditMoveLines);
    }
    return advancePaymentMoveLines;
}
Also used : InvoicePayment(com.axelor.apps.account.db.InvoicePayment) RefundInvoice(com.axelor.apps.account.service.invoice.generator.invoice.RefundInvoice) Invoice(com.axelor.apps.account.db.Invoice) MoveLine(com.axelor.apps.account.db.MoveLine) ArrayList(java.util.ArrayList) InvoicePaymentToolService(com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentToolService)

Aggregations

Invoice (com.axelor.apps.account.db.Invoice)1 InvoicePayment (com.axelor.apps.account.db.InvoicePayment)1 MoveLine (com.axelor.apps.account.db.MoveLine)1 RefundInvoice (com.axelor.apps.account.service.invoice.generator.invoice.RefundInvoice)1 InvoicePaymentToolService (com.axelor.apps.account.service.payment.invoice.payment.InvoicePaymentToolService)1 ArrayList (java.util.ArrayList)1