frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
20.82k stars 7.15k forks source link

Process Deferred Accounting inconsistent with discounts or negative Item Amount #42112

Open konradbr opened 3 months ago

konradbr commented 3 months ago

Information about bug

description

Posting a Purchase Invoice where one of the Items is, say, a discount, such that the Amount field has a negative value, and Enable Deferred Expense is checked, the "deferred discount" will be incorrectly accounted, such that the full value of the Amount will be posted in full at the end of the Service Period and pro-rated at the beginning of the Service Period, resulting in a NON-ZERO TOTAL.

steps to reproduce

  1. Create Purchase Invoice.
  2. Add at least one item to said Purchase Invoice with:
    • a positive Amount
    • Enable Deferred Expense checked
    • Service Start Date to e.g. 2024-06-18
    • Service End Date to e.g. 2024-07-17
  3. Add at least one Item to said Purchase Invoice with:
    • a negative Amount
    • the same other parameters as above
  4. Post said Purchas Invoice.
  5. Post a Process Deferred Accounting with appropriate dates, e.g.:
    • Posting Date 2024-12-31
    • Service Start Date 2024-01-01
    • Service End Date 2024-12-31
  6. Analyse the General Ledger with filters set to the corresponding deferred account and grouping disabled.

The result should be as described above.

example

Example from CSV export:

Screenshot 2024-06-30 at 16 33 43 annotated

Module

accounts

Version

bench 5.17.2
erpnext 15.27.6
erpnextswiss 1.23.3
frappe 15.29.2
hrms 15.22.2
payments 0.0.1

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

konradbr commented 3 months ago

NOTE: the negative Amount in the Purchase Invoice Item was in this case EUR (5.00).