Skip to content

Commit

Permalink
Merge pull request adempiere#3481 from erpcya/bugfix/#MM-Price-List-C…
Browse files Browse the repository at this point in the history
…reate-Bad-Source

Bad reference for price list create process
  • Loading branch information
e-Evolution committed Jun 30, 2021
2 parents 12dd192 + 5db1c4d commit 4489257
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions base/src/org/compiere/process/M_PriceList_Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ protected String doIt() throws Exception {
new ProductCombination(productPurchasing.getM_Product_ID(),
conversionRate,
productPurchasing.getPriceList(),
productPurchasing.getPriceList(),
productPurchasing.getPricePO(),
productPurchasing.getPricePO(),
discountSchemaLine));
});
Expand Down Expand Up @@ -540,9 +540,21 @@ private class ProductCombination {
public ProductCombination(int productId, BigDecimal conversionRate, BigDecimal priceList, BigDecimal priceStandard, BigDecimal priceLimit, MDiscountSchemaLine discountSchemaLine) {
this.productId = productId;
this.conversionRate = conversionRate;
this.priceList = Optional.ofNullable(priceList).orElse(Env.ZERO);
this.priceStandard = Optional.ofNullable(priceStandard).orElse(Env.ZERO);
this.priceLimit = Optional.ofNullable(priceLimit).orElse(Env.ZERO);
BigDecimal defaultPrice = Optional.ofNullable(priceList).orElseGet(() -> {
// Standard
if(Optional.ofNullable(priceStandard).isPresent()) {
return priceStandard;
}
// Limit
if(Optional.ofNullable(priceLimit).isPresent()) {
return priceLimit;
}
// Default
return Env.ZERO;
});
this.priceList = Optional.ofNullable(priceList).orElse(defaultPrice);
this.priceStandard = Optional.ofNullable(priceStandard).orElse(defaultPrice);
this.priceLimit = Optional.ofNullable(priceLimit).orElse(defaultPrice);
this.discountSchemaLine = discountSchemaLine;
}

Expand Down

0 comments on commit 4489257

Please sign in to comment.