#59628·erpnext

Purchase Order: submitted PO with a submitted Payment Request can't be updated — status "To Pay" is not in the Status options (follow-up to frappe/erpnext#54491)

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

This is the same root cause as #54491, which was closed with the reply "You can't create a payment request without submitting the purchase order". That reply fits the steps in #54491 (the PO was still a draft), but the bug also happens with a correctly submitted PO, following the normal workflow.

erpnext/controllers/status_updater.py sets a Purchase Order to "To Pay" when advance_payment_status == "Initiated", and the PO list view and the Purchase Order Analysis report both use "To Pay". But the status field in erpnext/buying/doctype/purchase_order/purchase_order.json does not list "To Pay" among its options:

"options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered"

So once a PO is in "To Pay", every later save of that PO fails option validation.

Steps to reproduce

  1. Create a Purchase Order with a payment schedule and submit it.
  2. From the PO, create a Payment Request (outward, advance) and submit it. The PO status becomes "To Pay" (advance_payment_status = "Initiated").
  3. On the PO, click Update Items and change a rate or add a row, then click Update.

Expected: the items are updated.

Actual:

Status cannot be "To Pay". It should be one of "", "Draft", "On Hold", "To Receive and Bill", "To Bill", "To Receive", "Completed", "Cancelled", "Closed", "Delivered"

The same error is raised by any other update-after-submit save of the PO, for example changing an allow-on-submit field. The PO can't be changed until the Payment Request is paid or cancelled.

Suggested fix

Add "To Pay" to the options of the status field in purchase_order.json:

diff
- "options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered"
+ "options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered\nTo Pay"

Workaround until then: a Property Setter on Purchase Order → status → options that appends "To Pay".

Why we run into this: A supplier may bill us in milestones for one PO. We record each down-payment invoice as a Payment Request. If these Payment Requests have not been paid yet but we need to update the PO — for example Update Items to change a rate or add a row — we can't. Because the PO is in "To Pay", every change is refused until the Payment Request is paid. The only workaround is to cancel the Payment Request, update the PO, and create the Payment Request again, since Payment Requests cannot be amended, it will be a new number.

Module

buying

Version

Version: Frappe 16.29.0 / ERPNext 16.30.0 Installation method: self-hosted (bench)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

bash