Passing supplier quotation details to Item Price List

Dear All,

I want to insert supplier quotation/customer quotation reference to particular item price whenever its created. is there any way that we can pass these details up on creating a new item price from any of above documents? as it will be easy to trace the pricing source.

Thank you,
Ramaly

Hi @ramalyb,

You want to develop this scenario then you should apply logic using the client script and server script.

Thank You!

Dear @NCP is there any idea how to initiate this?

Hi @ramalyb,

Please apply the server script in your custom app.

Please add in hooks.py

doc_events = {
	"Supplier Quotation": {
		"on_submit": "custom_app.custom_app.doc_events.insert_item_price",
	}
}
import frappe

def insert_item_price(doc, method):
    # Iterate through items in the Supplier Quotation
    for item in doc.items:
        # Create a new Item Price record
        item_price = frappe.new_doc("Item Price")
        item_price.item_code = item.item_code
        item_price.price_list = doc.buying_price_list 
        item_price.price_list_rate = item.rate
        item_price.currency = doc.currency
        item_price.reference = doc.name
        item_price.save()

field set/change your field name according to the scenario.

Otherwise, if you don’t want to enter the code in your custom app then you can apply it on the server script doctype.

I hope this helps.

Thank You!

1 Like

Sorry @NCP ,

I haven’t read your comment properly, ill try the server script method as i m on cloud subscription.

Thank you,
Ramaly

Dear @NCP good day, i tried above server script but it didnt update anything on item price record. could you please check and advice?

Thank you,
Ramaly

Hi @ramalyb,

Please check it.

If you want to add a new price for an item from a supplier quotation in ERPNext, the script provided will do it correctly. However, if the price for that item already exists, the script won’t do anything. To handle updating existing item prices, you’ll need to develop an updated script.

I hope this helps.

Thank You!