> Incorrect adjustment billing invoice items create when Picking/Packing Shipment containing an OrderItem associated more than one ship groups with different destinations
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: OFBIZ-5360
> URL:
https://issues.apache.org/jira/browse/OFBIZ-5360> Project: OFBiz
> Issue Type: Bug
> Components: accounting
> Affects Versions: Release Branch 12.04
> Reporter: Christian Carlow
>
> The invoice billing issue mentioned in
https://issues.apache.org/jira/browse/OFBIZ-5346?filter=-2 occurs even if only a single order item is issued to a shipment if it is associated with at least one other ship group with a different destination than the first.
> To reproduce:
> 1. Create a new order for "DemoCustCompany"
> 2. Add the product "PEPPERS-G" to the order with a quantity of 2
> 3. Click "Finalize Order"
> 4. Click "Add New Ship Group" on the Shipping page, assign the destination as the California address, and click "Continue"
> 5. Add 1 quantity to the second ship group so that there is 1 item for each
> 6. Finish the remaining steps to create the order
> 7. Click "New Shipment for Ship Group"
> 8. Navigate to the "Order Items" page and issue a quantity of 1 to the shipment
> 9. Navigate to the "Edit" page and change the statusId to Pick or Pack to initiate the invoicing service
> The invoice that gets created contains adjustment billing invoice items for both addresses even though the shipment was for only one destination.
> The issue seems to be caused by these line of the "createInvoiceForOrder" function in InvoiceServices.java:
> List<GenericValue> itemAdjustments = OrderReadHelper.getOrderItemAdjustmentList(orderItem, orh.getAdjustments());
> List<GenericValue> headerAdjustments = orh.getOrderHeaderAdjustments();
> Both are too general and don't account for the shipGroupSeqId. The first line gets the list for SALES_TAX to apply; the second gets the list for SHIPPING_CHARGES.