You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Anil K Patel (Jira)" <ji...@apache.org> on 2026/06/30 14:21:00 UTC

[jira] [Commented] (OFBIZ-423) Invoice pro-rates adjustments

    [ https://issues.apache.org/jira/browse/OFBIZ-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18092669#comment-18092669 ] 

Anil K Patel commented on OFBIZ-423:
------------------------------------

Tested on current {{trunk}} ({{Release Trunk}}, demo data) — this issue does *not* reproduce. The item-level discount is correctly pro-rated to the partial shipment.

h4. Test setup

* Sales order for DemoCustomer: product GZ-1000, qty 10 @ $15.99 = $159.90 (used the Physical Retail Store to avoid the e-commerce store's automatic promotions, which would otherwise add their own adjustments).
* Added an *item-level* discount adjustment of -$63.96 (= 40% of 10 x $15.99) on the order item. Confirmed it is a true item adjustment (OrderAdjustment with orderItemSeqId set, DISCOUNT_ADJUSTMENT).
* Approved the order, shipped *only 5 of the 10* units, and set the shipment to PACKED, which triggers createInvoicesFromShipment.

h4. Resulting invoice items

|| Item || Type || Qty || Amount || Total ||
| 00001 | Finished Good (GZ-1000) | 5 | $15.99 | $79.95 |
| 00002 | Sales Tax | 1 | $3.798 | $3.798 |
| 00003 | Sales Tax | 1 | $0.08 | $0.08 |
| *00004* | *Discount (item-level 40%)* | *1* | *-$31.98* | *-$31.98* |
| 00005 | Sales Tax adj. (order change) | 1 | -$1.551 | -$1.551 |
| 00006 | Shipping & Handling | 1 | $5.00 | $5.00 |

Invoice total: $55.30. GL posts $31.98 to "DISCOUNTS ON SALES".

h4. Analysis

The discount on the partial invoice is *-$31.98*, which is exactly:
* 40% of the 5 shipped units ($79.95 x 0.40), and
* half of the full-order discount (-$63.96 x 5/10).

The invoice does not carry the full -$63.96, and the discount is not mis-attributed across the 10 ordered units. The two framings in the report ("5 items x 40%" vs "10 items x 20%") are arithmetically identical ($31.98), and trunk produces precisely that correctly pro-rated amount, tied to the shipped quantity. (OFBiz represents adjustment invoice lines as quantity = 1 with the full pro-rated amount, so there is no per-unit "quantity x percentage" line to be wrong.)


> Invoice pro-rates adjustments
> -----------------------------
>
>                 Key: OFBIZ-423
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-423
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>            Reporter: Iain Fogg
>            Priority: Minor
>
> 1. Create and order for (say) 10 of an item with an item level discount of (say) 40%.
> 2. When you receive the shipment, specify (say) 5 as the quantity received (the rest are back-ordered)
> 3. Receive the shipment into inventory
> 4. Edit the shipment and change the status to 'Shipped'
> 5. Look at the invoice and instead seeing 5 item adjustments @ 40%, you see 10 item adjustments @ 20%
> Obviously, invoice is being created and pro-rating the size of the item adjustments by the proportion of the order actually received. It should be including the full adjustment for only the actual number received.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)