Picklist creation via Rest API

Hello guys,

I’m on ERPNext: v14.3.1 (version-14).
When I try to create a picklist based on a material request, I get a an exception: “TypeError: ‘NoneType’ object is not iterable” - it tries to iterate over the locations in “for location in self.get(“locations”)”.

I use the following payload to post to “…/resource/Pick List” (the material request exists):

{
    "data": {
            "company": "HF",
            "purpose": "Material Transfer",
            "customer": null,
            "customer_name": null,
            "work_order": null,
            "material_request": "MAT-MR-2023-00004",
            "for_qty": 0.0,
            "parent_warehouse": "Cluster Area - HF"
    }
}

Any idea how to create a picklist via API?

Thanks!

Alex

Because the location is mission so please set the location:

Then reload and check it.

Thank You!

Hey NCP,

thank you for your answer! Well, I only use the API, and as far as I understood the system should fetch die target location from the material request, and the source location should be filled in automatically?

Thanks,

Alex

Hi @MrPec,

When creating a picklist using API, you don’t need to include the locations field in your payload. The system will automatically fetch the target location from the material request and populate the source location based on the parent warehouse you provide. Simply include the necessary information like company, purpose, material request ID, parent warehouse, etc., in your payload, and the system will take care of the rest.

Thank You!

Hi NCP,

yes, thats exactly my point and what I did. I created a Material request with two items like this:

Then I simply try to POST a picklist for the above Material Request with the following payload to the endpoint …/resource/Pick List:
image

But the result is:

Maybe I’m missing smth in the payload, but I don’t know what?

Thanks!

Alex

Hi guys,

has anyone an idea? Has anyone ever created a Picklist doc via API?
I would really appreciate some help here, it’s blocking my effort in using ERPNext in a warehouse.

Thanks!

Alex