Hi , I have a problem , when i send a post request to sales order it give me 400 error
here it is :
http://localhost:8000/api/method/onlinestore.www.shopcart.addToShopcart Failed to load resource: the server responded with a status of 400 (BAD REQUEST)
http://localhost:8000/api/method/onlinestore.www.shopcart.addToShopcart XHR finished loading: POST “http://localhost:8000/api/method/onlinestore.www.shopcart.addToShopcart”.
when i press on the link i see that my code works find and i see the message i set for which is : {“message”:“done”}
here’s my python method :
@frappe.whitelist(allow_guest=True)
def addToShopcart():
item = frappe.get_list(“Item”, “*”, filters={“item_code”: “02”})
if item:
price = "22"
ss = frappe.get_doc({
"doctype": "Sales Order",
"delivery_date": "05 - 12 - 2016",
"transaction_date": "05-12-2016",
"customer": "Yussuf",
"items": [{"item_code": item[0].item_code,
"item_name": item[0].item_name,
"description": item[0].description,
"price": price}]
});
ss.insert(ignore_permissions=True)
return "done"
else:
msg = "No such item available"
return msg
any suggesting .??