fix bug Mass Suppl. Stock Move Invoicing
regler le probleme de facturations en mass pour BR , relier la facture et le bon de recepetion
This commit is contained in:
@@ -523,13 +523,16 @@ public class StockMoveMultiInvoiceServiceImpl implements StockMoveMultiInvoiceSe
|
||||
} else {
|
||||
stockMoveList.forEach(
|
||||
stockMove -> {
|
||||
if (stockMove.getInvoiceSet() != null) {
|
||||
stockMove.getInvoiceSet().add(invoice);
|
||||
} else {
|
||||
|
||||
Set<Invoice> invoiceSet = new HashSet<>();
|
||||
invoiceSet.add(invoice);
|
||||
stockMove.setInvoiceSet(invoiceSet);
|
||||
}
|
||||
|
||||
String sqlString = String.format("INSERT INTO public.account_invoice_stock_move_set( invoice_set, stock_move_set) VALUES (:invoiceSet, :stockMoveSet)");
|
||||
javax.persistence.Query query = JPA.em().createNativeQuery(sqlString);
|
||||
query.setParameter("invoiceSet", invoice.getId());
|
||||
query.setParameter("stockMoveSet", stockMove.getId());
|
||||
JPA.runInTransaction(query::executeUpdate);
|
||||
});
|
||||
return Optional.of(invoice);
|
||||
}
|
||||
@@ -676,14 +679,8 @@ public class StockMoveMultiInvoiceServiceImpl implements StockMoveMultiInvoiceSe
|
||||
/** This method will throw an exception if the given stock move is already invoiced. */
|
||||
protected void checkIfAlreadyInvoiced(StockMove stockMove) throws AxelorException {
|
||||
if (stockMove.getInvoiceSet() != null
|
||||
&& stockMove
|
||||
.getStockMoveLineList()
|
||||
.stream()
|
||||
.map(StockMoveLine::getQtyInvoiced)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO)
|
||||
.compareTo(BigDecimal.ZERO)
|
||||
== 0) {
|
||||
&& stockMove.getInvoiceSet().stream()
|
||||
.anyMatch(invoice -> invoice.getStatusSelect() != InvoiceRepository.STATUS_CANCELED)) {
|
||||
String templateMessage;
|
||||
if (stockMove.getTypeSelect() == StockMoveRepository.TYPE_OUTGOING) {
|
||||
templateMessage = IExceptionMessage.OUTGOING_STOCK_MOVE_INVOICE_EXISTS;
|
||||
|
||||
Reference in New Issue
Block a user