kartoza / GeoHosting

https://kartoza.github.io/GeoHosting/
GNU Affero General Public License v3.0
0 stars 0 forks source link

Status on Order Status can't be changed #150

Open meomancer opened 2 months ago

meomancer commented 2 months ago

GeoHosting will update Order Sale status on the ERP But the problem is when updating status to To Bill, To Deliver and Completed it change back to draft again on erpnext, so not sure how to fix it.

Example order status: PUT https://kartoza-staging-v14.frappe.cloud/api/resource/Sales Order/SAL-ORD-2024-00268

Payload

{
    "status": "To Bill"
}

Maybe there is requirements for other fields to make the specific status?

voogt commented 2 months ago

Hi @meomancer can you please try to add the following field to your request? "doc_status": 1 the 1 means the doc is submitted to allow the status to be changed to "To Bill" etc

meomancer commented 2 months ago

Still not working on my side, is it working on your side @voogt ?

{
           "doc_status": 1,
            "status": "To Bill"
        }
voogt commented 2 months ago

Apologies @meomancer it was a spelling mistake from my part The method should be POST and not PUT the body should be as follows

{
    "docstatus": 1
}

If the status is Draft and the above api call was made the the Sales order will be submitted and the status of Sales Order will update to "Deliver and Bill" image

meomancer commented 2 months ago

Hi @voogt Could you provide me how to change status

Draft
On Hold
To Deliver and Bill
To Bill
To Deliver
Completed

I tried using "docstatus": 2, it does not change

voogt commented 2 months ago

Hi @meomancer erp does not allow for docstatus to have a number 2. 0 means its still in draft and 1 means it submitted. I did a bit more testing, erp wont let me change the status to "To Bill" etc. after I have updated the doctstatus to 1. The reason for this is erp wants to keep the data integrity of the sales order. My proposed workflow is the following

  1. Create a put request with the following body to update the amount billed to 100% {"per_billed": 100}
  2. Create a put request with the following body to update the amount delivered to 100% {"per_delivered": 100}
  3. Finally create a put request with the following body to update the status as completed and to submit the sales order {"status": "Completed", "docstatus": 1}