/** * Methode permettant de mettre à jour les informations de la facture * * @param moveLine * @param paymentMove * @param pse * @param mlList * @return * @throws AxelorException */ public Invoice updateInvoice( MoveLine moveLine, Move paymentMove, List<MoveLine> mlList, BigDecimal amountExported, long directDebitManagementMaxId) throws AxelorException { Invoice invoice = cfonbExportService.getInvoice(moveLine); this.testBankDetails(invoice); Company company = invoice.getCompany(); // Mise à jour du champ 'Ecriture de paiement' sur la facture log.debug( "generateAllExportInvoice - Mise à jour du champ 'Ecriture de paiement' sur la facture"); invoice.setPaymentMove(paymentMove); // Mise à jour du montant prélever invoice.setDirectDebitAmount(amountExported); // Mise à jour du Numéro de prélèvement sur la facture log.debug("Mise à jour du Numéro de prélèvement sur la facture"); if (this.hasOtherInvoice(mlList, moveLine)) { DirectDebitManagement directDebitManagement = this.getDirectDebitManagement(mlList, moveLine, directDebitManagementMaxId); if (directDebitManagement == null) { directDebitManagement = this.createDirectDebitManagement(this.getDirectDebitSequence(company), company); } invoice.setDirectDebitManagement(directDebitManagement); invoice.setDebitNumber(null); directDebitManagement.getInvoiceSet().add(invoice); directDebitManagementRepo.save(directDebitManagement); } else { invoice.setDebitNumber(this.getDirectDebitSequence(company)); invoice.setDirectDebitManagement(null); } return invoice; }
public boolean isDebitBlocking(Invoice invoice) { return blockingService.isDebitBlockingBlocking(invoice.getPartner(), invoice.getCompany()); }