Passing supplier quotation details to Item Price List

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