Fetch Value From Master

Please help me when choosing the item code, its barcode number appears

Hello,

Is this a custom field made by you?

Regards,

Ivan

Hello,

Yes made by me

Regards,

Majed

Hello,

You have to put up a Custom Script on this one and then use a frappe.call in order to get the value of your barcode from the chosen Item Code and use frm.set_value to set the barcode.

Check this code out:

For more information:
https://frappeframework.com/docs/user/en/api/form
https://frappeframework.com/docs/user/en/guides/basics/frappe_ajax_call

Regards,

Ivan

does the item price need to have the barcode? or the actual item?

If it’s just the item, a simple item_code.new_field in the fetch of the according field on eg. quotation item does work.

if it’s really on the item price, something like that should work:

		frappe.ui.form.on("Quotation Item", "item_code", function (frm, cdt, cdn) {
           var d = locals[cdt][cdn];
           var pricelist = d.pricelist;
			frappe.db.get_value("Item Price", {
				"item_code": d.item_code,
				"price_list": pricelist
			}, ['new_field1', 'new_field2'], function (value) {
				
					d.field1= value.new_field1;
					d.field2 = value.new_field2;
				
			}); });