Set dynamic decimal digits for Sale WorkFlow

This commit is contained in:
2023-01-07 18:04:40 +01:00
parent f716a7578a
commit 937d139f0c
10 changed files with 44 additions and 17 deletions

View File

@@ -160,13 +160,13 @@ public class PriceListService {
if (discountTypeSelect == PriceListLineRepository.AMOUNT_TYPE_FIXED) {
return unitPrice
.subtract(discountAmount)
.setScale(5, RoundingMode.HALF_UP);
.setScale(appBaseService.getNbDecimalDigitForSalePrice(), RoundingMode.HALF_UP);
} else if (discountTypeSelect == PriceListLineRepository.AMOUNT_TYPE_PERCENT) {
return unitPrice
.multiply(new BigDecimal(100).subtract(discountAmount))
.divide(
new BigDecimal(100),
5,
appBaseService.getNbDecimalDigitForSalePrice(),
RoundingMode.HALF_UP);
}

View File

@@ -74,4 +74,6 @@ public interface AppBaseService extends AppService {
* @param manageMultiBanks the new value for the manageMultiBanks boolean
*/
void setManageMultiBanks(boolean manageMultiBanks);
public int getNbDecimalDigitForSalePrice();
}

View File

@@ -104,6 +104,18 @@ public class AppBaseServiceImpl extends AppServiceImpl implements AppBaseService
return DEFAULT_NB_DECIMAL_DIGITS;
}
@Override
public int getNbDecimalDigitForSalePrice() {
AppBase appBase = getAppBase();
if (appBase != null) {
return appBase.getNbDecimalDigitForSalePrice();
}
return DEFAULT_NB_DECIMAL_DIGITS;
}
@Override
public String getDefaultPartnerLanguageCode() {

View File

@@ -35,6 +35,7 @@
<integer name="productInAtiSelect" title="Products ATI/WT" selection="base.in.ati.select" default="1"/>
<integer name="nbDecimalDigitForUnitPrice" title="Nb of digits for unit prices" max="10" default="2"/>
<integer name="nbDecimalDigitForSalePrice" title="Nb of digits for sale pruce" max="10" default="2"/>
<integer name="computeMethodDiscountSelect" title="Compute Method for Discounts" selection="base.compute.method.discount.select" default="1"/>