Commit 8d3d2149 authored by Jacques Le Roux's avatar Jacques Le Roux

Fixed: Bug when order contains adjustments with NULL amount


The issue was introduced by OFBIZ-7012 where adding isTaxIncludedInPrice was
missing at line 565. Because the compared amount in this line (in the adjustment)
is different from 0 and equals to amountAlreadyIncluded only if
the tax is included in price

Thanks: Amine Azzi
parent 6e1c7b59
......@@ -558,11 +558,11 @@ public class InvoiceServices {
// Set adjustment amount as amountAlreadyIncluded to continue invoice item creation process
Boolean isTaxIncludedInPrice = "VAT_TAX".equals(adj.getString("orderAdjustmentTypeId")) && UtilValidate.isNotEmpty(adj.getBigDecimal("amountAlreadyIncluded")) && adj.getBigDecimal("amountAlreadyIncluded").signum() != 0;
if ((adj.getBigDecimal("amount").signum() == 0) && isTaxIncludedInPrice) {
if (isTaxIncludedInPrice && (adj.getBigDecimal("amount").signum() == 0)) {
adj.set("amount", adj.getBigDecimal("amountAlreadyIncluded"));
// If the absolute invoiced amount >= the abs of the adjustment amount, the full amount has already been invoiced, so skip this adjustment
if (adjAlreadyInvoicedAmount.abs().compareTo(adj.getBigDecimal("amount").setScale(invoiceTypeDecimals, ROUNDING).abs()) > 0) {
if (isTaxIncludedInPrice && adjAlreadyInvoicedAmount.abs().compareTo(adj.getBigDecimal("amount").setScale(invoiceTypeDecimals, ROUNDING).abs()) > 0) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment