#59585·erpnext

Credit note on an invoice with allocated advances fails: "Rows: 1 in Advance Payments section are invalid"

Author: maasantoCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbug

Information about bug

Image

Steps

Sales Order → Payment Entry against the order → Sales Invoice from the order with the advance allocated (Allocate Advances Automatically) → submit → Create > Return / Credit Note → Save.

Actual: "Rows: 1 in Advance Payments section are invalid. Reference Name should point to a valid Payment Entry or Journal Entry."

Cause

make_return_doc has no table map for advances, so get_mapped_doc copies the table and blanks the no_copy reference_type / reference_name / allocated_amount. The return also inherits allocate_advances_automatically, so once the rows are dropped, set_advances re-pulls any still-open order advance with a negative allocation.

Fix on my fork: (https://github.com/maasanto/erpnext/commit/db20f6b084).

Module

accounts

Version

develop

Installation method

None

Relevant log output / Stack trace / Full Error Message.

bash