IDEMPIERE-2753 Discount is not calculated when Price List Price <1 (#119)

Bring one more point of failure discovered by Elaine Tan
This commit is contained in:
Carlos Ruiz 2020-06-16 13:55:40 +02:00 committed by GitHub
parent 2706026b85
commit fe69eb9dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -818,7 +818,7 @@ public class MProductPricing extends AbstractProductPricing
public BigDecimal getDiscount() public BigDecimal getDiscount()
{ {
BigDecimal Discount = Env.ZERO; BigDecimal Discount = Env.ZERO;
if (m_PriceList.intValue() != 0) if (m_PriceList.compareTo(Env.ZERO) != 0)
Discount = BigDecimal.valueOf((m_PriceList.doubleValue() - m_PriceStd.doubleValue()) Discount = BigDecimal.valueOf((m_PriceList.doubleValue() - m_PriceStd.doubleValue())
/ m_PriceList.doubleValue() * 100.0); / m_PriceList.doubleValue() * 100.0);
if (Discount.scale() > 2) if (Discount.scale() > 2)