I have finished products with price $0.00 in my system. There is a requirement to place an order with $0.00 price product. As I also need to fulfill this order, I need to have Shipping method applied here (Other than No Shipping method). So what I am doing is place the order with $0.00 subtotal and Shipping lets say of $20.00 so that order total is $20.00. The order gets placed successfully in Ofbiz OOTB.
Now in order to make the order total $0.00 (requirement of not charging any amount for the order) I apply manual discount of $20.00 from order view page to cancel the shipping charges of $20.00.
The issue comes when fulfilling the order. The invoice created on quick shipping the order is not correct. Shipping amount and discount are not included in invoice.
The issue is coming in 'createInvoiceForOrder' service. Here in this service, invoice items corresponding to all the order items and adjustments are created. At time of invoicing adjustment of type 'SHIPPING_CHARGES' (approx. line no. 712 of InvoiceServices.java), calculation of pro-rate shipping is done. This is where we are having issue in our scenario. The shippable total in our case is 0. This in turn make the 'divisor' and 'multiplier' used for pro-rate shipping 0. That is why the Shipping Adjustment is not getting invoiced in our case.