Multilevel fetching not working

first when i select item,
item will fetch Item Price ID (rate) of that item (that’s i fetch from Item Price),
then i am not able to fetch rate because Item Price doctype naming series different from my item code
what to do now ?
any help
means Item>>Item Price>> Rate (I need only rate of item)

Hi @nilpatel42,

As per scenario, If Item has a multiple price or price list according price then how to get rate.

If you want to get Item price for Statically Price List then possible.

Is Item Price ID set in Item Master(DocType)?

item don’t have multiple pricing
Item Price ID is in random - hash
i don’t understand by get Item price for Statically Price List then possible.

I know but Your Item has a only One Price? and Can you define the Item Price ID in Item DocType?

Means Standard Selling/Buying Price

Item Price ID is default doctype, that why i am not able change it, currently it is define random
if you have different method to fetch rate, i am ok with that

thank you

SS of Item Price ID which is rondom

I know Item Price generate the hash function.

I think you don’t understand what i am saying.

I said can you added a custom field of Item Price which has id show in field in Item DocType?

You want, when you select the Item then Item Price and Rate automatically set?
Right?

If right then Is a Standing Selling Price List Rate or Standing Buying Price List Rate?

Your doctype is a parent doctype or child doctype?

no i haven’t added any custom field in Item Doctype

You want, when you select the Item then Item Price and Rate automatically set?
Right?

Yes

If right then Is a Standing Selling Price List Rate or Standing Buying Price List Rate?

Standing Selling Price List Rate

Your doctype is a parent doctype or child doctype?

thank you

Hi @nilpatel42,

Remove all condition from fetch from in Price DocType and apply the client script for it.

frappe.ui.form.on("Price", {
    model: function(frm) {
        frappe.db.get_value("Item Price", {"item_code": frm.doc.model, "price_list": "Standard Selling"}, 
        ["name", "price_list_rate"], function(value) {
            frm.set_value('item', value.name);
            frm.set_value('price', value.price_list_rate);
        });
    }
});

Please check the doctype name, fieldname set in the script accordingly.

Then reload and check it.

Thank You!

2 Likes

Thank Bro, Working smoothly :love_you_gesture: