Compare commits
1 Commits
dev2
...
invoiceLin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da686191fc |
@@ -130,8 +130,7 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
if (StockMoveRepository.ORIGIN_SALE_ORDER.equals(stockMove.getOriginTypeSelect())) {
|
||||
invoice = createInvoiceFromSaleOrder(stockMove, saleOrderRepo.find(origin), qtyToInvoiceMap);
|
||||
} else if (StockMoveRepository.ORIGIN_PURCHASE_ORDER.equals(stockMove.getOriginTypeSelect())) {
|
||||
invoice =
|
||||
createInvoiceFromPurchaseOrder(
|
||||
invoice = createInvoiceFromPurchaseOrder(
|
||||
stockMove, purchaseOrderRepo.find(origin), qtyToInvoiceMap);
|
||||
} else {
|
||||
invoice = createInvoiceFromOrderlessStockMove(stockMove, qtyToInvoiceMap);
|
||||
@@ -147,8 +146,7 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
for (StockMoveLine subLine : stockMoveLine.getSubLineList()) {
|
||||
BigDecimal qty = BigDecimal.ZERO;
|
||||
if (stockMoveLine.getQty().compareTo(BigDecimal.ZERO) != 0) {
|
||||
qty =
|
||||
qtyToInvoiceItem
|
||||
qty = qtyToInvoiceItem
|
||||
.multiply(subLine.getQty())
|
||||
.divide(stockMoveLine.getQty(), 2, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
@@ -164,8 +162,8 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
StockMove stockMove, SaleOrder saleOrder, Map<Long, BigDecimal> qtyToInvoiceMap)
|
||||
throws AxelorException {
|
||||
|
||||
InvoiceGenerator invoiceGenerator =
|
||||
saleOrderInvoiceService.createInvoiceGenerator(saleOrder, stockMove.getIsReversion());
|
||||
InvoiceGenerator invoiceGenerator = saleOrderInvoiceService.createInvoiceGenerator(saleOrder,
|
||||
stockMove.getIsReversion());
|
||||
|
||||
Invoice invoice = invoiceGenerator.generate();
|
||||
|
||||
@@ -215,8 +213,7 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
StockMove stockMove, PurchaseOrder purchaseOrder, Map<Long, BigDecimal> qtyToInvoiceMap)
|
||||
throws AxelorException {
|
||||
|
||||
InvoiceGenerator invoiceGenerator =
|
||||
purchaseOrderInvoiceService.createInvoiceGenerator(
|
||||
InvoiceGenerator invoiceGenerator = purchaseOrderInvoiceService.createInvoiceGenerator(
|
||||
purchaseOrder, stockMove.getIsReversion());
|
||||
|
||||
Invoice invoice = invoiceGenerator.generate();
|
||||
@@ -274,8 +271,7 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
}
|
||||
}
|
||||
|
||||
InvoiceGenerator invoiceGenerator =
|
||||
new InvoiceGeneratorSupplyChain(stockMove, invoiceOperationType) {
|
||||
InvoiceGenerator invoiceGenerator = new InvoiceGeneratorSupplyChain(stockMove, invoiceOperationType) {
|
||||
|
||||
@Override
|
||||
public Invoice generate() throws AxelorException {
|
||||
@@ -340,12 +336,10 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
Long id = stockMoveLine.getId();
|
||||
if (qtyToInvoiceMap != null) {
|
||||
if (qtyToInvoiceMap.containsKey(id)) {
|
||||
invoiceLineListCreated =
|
||||
this.createInvoiceLine(invoice, stockMoveLine, qtyToInvoiceMap.get(id));
|
||||
invoiceLineListCreated = this.createInvoiceLine(invoice, stockMoveLine, qtyToInvoiceMap.get(id));
|
||||
}
|
||||
} else {
|
||||
invoiceLineListCreated =
|
||||
this.createInvoiceLine(
|
||||
invoiceLineListCreated = this.createInvoiceLine(
|
||||
invoice,
|
||||
stockMoveLine,
|
||||
stockMoveLine.getRealQty().subtract(stockMoveLine.getQtyInvoiced()));
|
||||
@@ -424,8 +418,7 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
stockMoveLine.getStockMove().getStockMoveSeq());
|
||||
}
|
||||
|
||||
InvoiceLineGenerator invoiceLineGenerator =
|
||||
new InvoiceLineGeneratorSupplyChain(
|
||||
InvoiceLineGenerator invoiceLineGenerator = new InvoiceLineGeneratorSupplyChain(
|
||||
invoice,
|
||||
product,
|
||||
stockMoveLine.getProductName(),
|
||||
@@ -465,7 +458,8 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of stock move lines consolidated by parent line (sale or purchase order).
|
||||
* Get a list of stock move lines consolidated by parent line (sale or purchase
|
||||
* order).
|
||||
*
|
||||
* @param stockMoveLineList
|
||||
* @return
|
||||
@@ -496,7 +490,9 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
stockMoveLinePurchaseMap.put(stockMoveLine.getPurchaseOrderLine(), list);
|
||||
}
|
||||
list.add(stockMoveLine);
|
||||
} else { // if the stock move line does not have a parent line (sale or purchase order line)
|
||||
resultList.add(stockMoveLine);
|
||||
} else { // if the stock move line does not have a parent line (sale or purchase order
|
||||
// line)
|
||||
resultList.add(stockMoveLine);
|
||||
}
|
||||
}
|
||||
@@ -544,14 +540,12 @@ public class StockMoveInvoiceServiceImpl implements StockMoveInvoiceService {
|
||||
stockMove = Beans.get(StockMoveRepository.class).find(stockMove.getId());
|
||||
|
||||
if (stockMove.getInvoiceSet() != null && !stockMove.getInvoiceSet().isEmpty()) {
|
||||
Double totalInvoicedQty =
|
||||
stockMove
|
||||
Double totalInvoicedQty = stockMove
|
||||
.getStockMoveLineList()
|
||||
.stream()
|
||||
.mapToDouble(sml -> Double.parseDouble(sml.getQtyInvoiced().toString()))
|
||||
.sum();
|
||||
Double totalRealQty =
|
||||
stockMove
|
||||
Double totalRealQty = stockMove
|
||||
.getStockMoveLineList()
|
||||
.stream()
|
||||
.mapToDouble(sml -> Double.parseDouble(sml.getRealQty().toString()))
|
||||
|
||||
Reference in New Issue
Block a user