Set dynamic decimal digits for Sale WorkFlow
This commit is contained in:
@@ -164,19 +164,19 @@ public class StockMoveLineServiceImpl implements StockMoveLineService {
|
||||
BigDecimal unitPriceTaxed;
|
||||
if (taxed) {
|
||||
unitPriceTaxed =
|
||||
unitPrice.setScale(appBaseService.getNbDecimalDigitForUnitPrice(), RoundingMode.HALF_UP);
|
||||
unitPrice.setScale(appBaseService.getNbDecimalDigitForSalePrice(), RoundingMode.HALF_UP);
|
||||
unitPriceUntaxed =
|
||||
unitPrice.divide(
|
||||
taxRate.add(BigDecimal.ONE),
|
||||
appBaseService.getNbDecimalDigitForUnitPrice(),
|
||||
appBaseService.getNbDecimalDigitForSalePrice(),
|
||||
RoundingMode.HALF_UP);
|
||||
} else {
|
||||
unitPriceUntaxed =
|
||||
unitPrice.setScale(appBaseService.getNbDecimalDigitForUnitPrice(), RoundingMode.HALF_UP);
|
||||
unitPrice.setScale(appBaseService.getNbDecimalDigitForSalePrice(), RoundingMode.HALF_UP);
|
||||
unitPriceTaxed =
|
||||
unitPrice
|
||||
.multiply(taxRate.add(BigDecimal.ONE))
|
||||
.setScale(appBaseService.getNbDecimalDigitForUnitPrice(), RoundingMode.HALF_UP);
|
||||
.setScale(appBaseService.getNbDecimalDigitForSalePrice(), RoundingMode.HALF_UP);
|
||||
}
|
||||
return this.createStockMoveLine(
|
||||
product,
|
||||
@@ -536,7 +536,7 @@ public class StockMoveLineServiceImpl implements StockMoveLineService {
|
||||
sum = sum.add(newPrice.multiply(newQty));
|
||||
BigDecimal denominator = oldQty.add(newQty);
|
||||
if (denominator.compareTo(BigDecimal.ZERO) != 0) {
|
||||
int scale = appBaseService.getNbDecimalDigitForUnitPrice();
|
||||
int scale = appBaseService.getNbDecimalDigitForSalePrice();
|
||||
newAvgPrice = sum.divide(denominator, scale, RoundingMode.HALF_UP);
|
||||
} else {
|
||||
newAvgPrice = oldAvgPrice;
|
||||
@@ -991,6 +991,7 @@ public class StockMoveLineServiceImpl implements StockMoveLineService {
|
||||
if (stockMove != null && !checkMassesRequired(stockMove, stockMoveLine)) {
|
||||
return product.getNetMass();
|
||||
}
|
||||
|
||||
|
||||
throw new AxelorException(
|
||||
TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
|
||||
@@ -1201,4 +1202,5 @@ public class StockMoveLineServiceImpl implements StockMoveLineService {
|
||||
stockLocationLineOpt.ifPresent(
|
||||
stockLocationLine -> stockMoveLine.setWapPrice(stockLocationLine.getAvgPrice()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user