[ 
https://issues.apache.org/jira/browse/OFBIZ-11316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amine Azzi reopened OFBIZ-11316:
--------------------------------

The issue was introduced by adding the following code.

Boolean isTaxIncludedInPrice = 
adj.getString("orderAdjustmentTypeId").equals("VAT_TAX") && 
UtilValidate.isNotEmpty(adj.getBigDecimal("amountAlreadyIncluded")) && 
adj.getBigDecimal("amountAlreadyIncluded").signum() != 0;
+ if ((adj.getBigDecimal("amount").signum() == 0) && isTaxIncludedInPrice) {
+ 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) {
 continue;

> Bug when order contains adjustments with NULL amount
> ----------------------------------------------------
>
>                 Key: OFBIZ-11316
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11316
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: Trunk
>            Reporter: Amine Azzi
>            Assignee: Jacques Le Roux
>            Priority: Major
>         Attachments: OFBIZ-11316.patch
>
>
> On org/apache/ofbiz/accounting/invoice/InvoiceServices.java:561.
> The condition evaluation gives an error when the adjustment has a null amount 
> even when isTaxIncludedInPrice is FALSE.
>  
> The condition should be re-written to
>  
> if (isTaxIncludedInPrice && (adj.getBigDecimal("amount").signum() == 0))



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to