Hey everyone
Again, I am hoping for some feedback and help because I find it hard to understand how ERPNext actually works
In this current scenario, I want to work with ERPNext only by using the REST API. I want to create Purchase Orders
and Purchase Receipts
based on those orders. My issue is, that the status of my Purchase Orders
stays To Receive and Bill
even though the corresponding Purchase Receipts
are in status Completed
.
This is how I create my Purchase Orders
:
po_endpoint = f'{erpnext_url}/api/resource/Purchase Order'
po_data = {
"supplier": "Primary Processor ABC",
"docstatus": 1,
"items": [
{
"item_code": "BB",
"custom_content": "MAT-ABS-5mm",
"schedule_date": schedule_date,
"qty": 1.0,
},
]
}
All good, I get HTTP 200 and a Purchase Order
id: po_id
This is how I create my Purchase Receipt
:
pr_endpoint = f'{erpnext_url}/api/resource/Purchase Receipt'
pr_data = {
"purchase_order": po_id,
"supplier": "Primary Processor ABC",
"docstatus": 1,
"items": [
{
"item_code": "BB",
"purchase_order": po_id,
"custom_content": "MAT-ABS-5mm",
"schedule_date": schedule_date,
"qty": 1.0,
},
]
}
All good, I get HTTP 200 and a Purchase Receipt
When I look at the ERPNext UI, my Purchase Receipt
is in status Completed
and has a Connection to the correct Purchase Order
.
However, when I click on the connected PO, I see that the status is still To Receive and Bill
:
It is even possible to created another Purchase Receipt
from the same Purchase Order
. ERPNext apparently has no problem creating multiple Purchase Receipts
from the same Purchase Order
exceeding the quantity of items.
I would be very grateful for some help because I donât know where to look for clues. I cannot explain this behaviour or ERPNext. And, please donât mind the Item field Content
. This is a Custom Field
we had to add to the DocTypes Item
, Purchase Order Item
and Purchase Receipt Item
.
All the best