Information about bug
What happens
After creating and submitting a Payment Request (advance payment) against a Purchase Order, I can no longer submit the Purchase Order. I get this error:
"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""
Steps to reproduce
- Enable "Fetch Payment Schedule in Payment Request" in Accounts Settings.
- Create a Purchase Order with Payment Terms → save.
- From the PO, Create → Payment Request → select a schedule row → submit the Payment Request. (This sets advance_payment_status = 'Initiated')
- Go to the PO → click Submit on the draft.
- → Error: Status cannot be "To Pay".
Root cause
Inconsistency between controller logic and the DocType field definition:
erpnext/controllers/status_updater.py — rule assigns "To Pay" to PO when advance_payment_status == 'Initiated':
[ "To Pay", "eval:self.advance_payment_status == 'Initiated' and self.docstatus == 1", ]
,
erpnext/buying/doctype/purchase_order/purchase_order.json — the status field's options list is missing "To Pay":
"options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered"
Module
buying
Version
Frappe version-16.15.0
ERPNext version-16.15.0
Installation method
docker
Relevant log output / Stack trace / Full Error Message.
Information about bug
What happens
After creating and submitting a Payment Request (advance payment) against a Purchase Order, I can no longer submit the Purchase Order. I get this error:
"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""
Steps to reproduce
Root cause
Inconsistency between controller logic and the DocType field definition:
erpnext/controllers/status_updater.py — rule assigns "To Pay" to PO when advance_payment_status == 'Initiated':
[ "To Pay", "eval:self.advance_payment_status == 'Initiated' and self.docstatus == 1", ],
erpnext/buying/doctype/purchase_order/purchase_order.json — the status field's options list is missing "To Pay":
"options": "\nDraft\nOn Hold\nTo Receive and Bill\nTo Bill\nTo Receive\nCompleted\nCancelled\nClosed\nDelivered"Module
buying
Version
Frappe version-16.15.0
ERPNext version-16.15.0
Installation method
docker
Relevant log output / Stack trace / Full Error Message.