You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2020/01/11 10:20:55 UTC

[ofbiz-framework] branch trunk updated: Fixed: Bug when order contains adjustments with NULL amount (OFBIZ-11316)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8d3d214  Fixed: Bug when order contains adjustments with NULL amount (OFBIZ-11316)
8d3d214 is described below

commit 8d3d2149fcfb1902357086696505de674d98bb8d
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sat Jan 11 11:19:23 2020 +0100

    Fixed: Bug when order contains adjustments with NULL amount
    (OFBIZ-11316)
    
    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
---
 .../java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
index 14f022d..05b707c 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
@@ -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) {
                         continue;
                     }