is any Rest API available to show the price_list_rate of specific Item for the selected customer.
There is not by default Rest API that get and show the price_list_rate of item against customer.
You can write a Python in which you can get the price_list_rate and return as a response.
this function will call by an API.
Thanks for the update…
Hi @jayakumar:
Depending on your pricing structure, maybe a simple server script could work. Note than sales price could be affected by customer, pricing rules, quantity, date, etc …
Assuming you have a simple scenario where price list is linked to customer, and a price for the product is setled on this price list.
An API server script like this works:
customer = frappe.form_dict.customer
product = frappe.form_dict.product
price_list = frappe.db.get_value("Customer", customer, "default_price_list")
product_price = frappe.db.get_value("Item Price", [{"item_code": product}, {"price_list":price_list}], "price_list_rate")
print (product_price)
frappe.response['message'] = product_price
From client side, try
frappe.call({
method: "product_price",
args: {
'customer': "CUSTOMER 01",
'product' : "PRODUCT 01"
}
})
You can manage any other variables, check this function for reference.
Hope this helps.
Thanks for the update, Looking for Rest API to be called from outside ERP Next, to access the Price List of Specific customer.
Hi @jayakumar:
You can call this server script method from outside like API REST. Check this:
https://frappeframework.com/docs/user/en/desk/scripting/server-script#3-4-api