mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 23:48:38 +00:00
* feat: allocate full actual charge to stock items only (e.g. Freight) Backport of #56102 to version-16-hotfix. Adapts the GL valuation-tax change to the inline make_tax_gl_entries in purchase_receipt.py (no services/ refactor on hotfix) and additionally applies it to purchase_invoice.py. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: distribute each Actual valuation charge individually distribute_actual_tax_amount pooled all "Actual" valuation charges (both the spread-across-all-items charges and the allocate_full_amount_to_stock_items freight charges) into single totals before spreading, while the GL path (get_capitalized_valuation_tax) capitalizes each tax row separately. For multiple charges over unevenly valued items, pool-then-spread can drift by a rounding cent from spread-each-then-sum, so a row's item_tax_amount no longer decomposed exactly into the per-account capitalized GL amounts (the document total still balanced). get_tax_details now returns the per-row charge amounts as lists and distribute_actual_tax_amount spreads each charge on its own, mirroring get_capitalized_valuation_tax. Per-item valuation now reconciles exactly with per-account GL credits. Single-charge behaviour is unchanged. Adds test_multiple_actual_charges_per_item_matches_gl_per_account covering two freight charges over items of net 100 and 200 (asserts 6.66 / 13.34, which the old pooled logic would have rounded to 6.67 / 13.33). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>