Create Sales Order via Python API

Hi, i am trying to create (insert / save / submit) Sales order via API (in order to sync order between all my sales channel) my main problem is that when i am creating sales order providing:
1 - customer
2 - delivery_date
3 - items
the insert and save hooks are not fetching the customer price list (so the items rate are wrong) and the taxes and charges tables is not loaded.
I searched in the source code but i am not finding which function to call to trigger the methods that fetch all this information. i know that all the fetch part is done in the client side but i was thinking the same logic was also implemented in server side.
So is there a function in server side that fetch all the informations when providing only the three information above (like client side) if not could someone help me to write this function ?
thanks

1 Like

I think you also need to pass “Price List” and “Taxes and Charges Template” at minimum.

1 Like

The Taxes and Charges Template is automaticaly fetched after insert but the taxes table is not populated

Try setting Item Tax Template in Item master against Tax Category. And set “Tax category” via API while creating sales order.

This is my traceback:
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/controllers/accounts_controller.py”, line 442, in validate_qty_is_not_zero
if not float(item.qty):
AttributeError: ‘str’ object has no attribute ‘qty’

My http request is:
https://lite.totall.mx/api/method/totall.api.orden_de_venta?customer=Santiago%20Ramos%20Morales&items=[“S006”:“10-03-2021”:1:“3500”:“3500”]