@Override protected void process() { for (Invoice invoice : invoices(batch.getInvoiceBatch(), true)) { try { invoiceService.validate(invoiceRepo.find(invoice.getId())); updateInvoice(invoiceRepo.find(invoice.getId())); } catch (AxelorException e) { TraceBackService.trace( new AxelorException( String.format(I18n.get("Facture") + " %s", invoice.getInvoiceId()), e, e.getcategory()), IException.INVOICE_ORIGIN, batch.getId()); incrementAnomaly(); } catch (Exception e) { TraceBackService.trace( new Exception(String.format(I18n.get("Facture") + " %s", invoice.getInvoiceId()), e), IException.INVOICE_ORIGIN, batch.getId()); incrementAnomaly(); } finally { JPA.clear(); } } }
public void reminderPartner() { int i = 0; List<Partner> partnerList = Partner.all() .filter( "self.reminderClosedOk = false AND ?1 IN self.companySet", batch.getAccountingBatch().getCompany()) .fetch(); for (Partner partner : partnerList) { try { boolean remindedOk = reminderService.reminderGenerate( Partner.find(partner.getId()), batch.getAccountingBatch().getCompany()); if (remindedOk == true) { updatePartner(partner); i++; } LOG.debug("Tiers traité : {}", partner.getName()); } catch (AxelorException e) { TraceBackService.trace( new AxelorException(String.format("Tiers %s", partner.getName()), e, e.getcategory()), IException.REMINDER, batch.getId()); incrementAnomaly(); } catch (Exception e) { TraceBackService.trace( new Exception(String.format("Tiers %s", partner.getName()), e), IException.REMINDER, batch.getId()); incrementAnomaly(); LOG.error("Bug(Anomalie) généré(e) pour le tiers {}", partner.getName()); } finally { if (i % 10 == 0) { JPA.clear(); } } } }
public void generateMail() { List<Mail> mailList = Mail.all() .filter( "(self.pdfFilePath IS NULL or self.pdfFilePath = '') AND self.sendRealDate IS NULL AND self.mailModel.pdfModelPath IS NOT NULL") .fetch(); LOG.debug("Nombre de fichiers à générer : {}", mailList.size()); for (Mail mail : mailList) { try { mailService.generatePdfMail(Mail.find(mail.getId())); mailDone++; } catch (AxelorException e) { TraceBackService.trace( new AxelorException( String.format("Courrier/Email %s", mail.getName()), e, e.getcategory()), IException.REMINDER, batch.getId()); mailAnomaly++; } catch (Exception e) { TraceBackService.trace( new Exception(String.format("Courrier/Mail %s", mail.getName()), e), IException.REMINDER, batch.getId()); mailAnomaly++; LOG.error("Bug(Anomalie) généré(e) pour l'email/courrier {}", mail.getName()); } } }