Set dynamic decimal digits for Sale WorkFlow
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user