Unable to fetch the Item custom field to quotation (child table is Quotation Item)

Dear Team,

I have created a custom field called Warrenty with the drop-down list in “Item” doctype. While creating quotation the Warrenty value is not fetching automatically even-though I have written a client side custom script as below in “Quotation Item” also tried in “Quotation”:

frappe.ui.form.on(‘Item’, {
onload: function(frm) {
frm.add_fetch(“item”, “warrenty”, “warrenty”);

}

});

Note: In the Quotation Item doctype also I have added the “warranty” custom field

Screenshot is attached:

Please advice on this.

1 Like

Could this just be a typo? should be warranty instead of warrenty?

the field name is stored as warrenty in the table that is correct.

The correct code in the script for quotation should be:

Most of the time if you have defined the custom field warrenty both in ‘item’ and ‘quotation item’ this should copy automatically.

You could try the following in the clientside script for quotation item

frm.add_fetch(‘item’, ‘warrenty’, ‘warrenty’);

I have tried this and above scripts. Both didn’t work.

What version are you on.
I created a custom field Warrenty field in Item of type Select with 3 options.
I created a custom field Warrenty in Quotation Item of the same type and with the same options.
I added no code and when I select an option in Item and save it. The quotation shows the selected value when I select this item…

I am using this version:
ERPNext: v11.1.33 (master)

Frappe Framework: v11.1.30 (master)

One more thing. Actually in Quotation that doctypes/line Items (warranty) should be fetched from Item doctype. We should not select warrenty again and again. It should automatically fetch from Warranty filed which is in doctype “Item”.

Screenshot has been attached for reference.

I’m on the same version and in my case warrenty is automatically filled from item, i don’t have to reselect it. I just created 2 custom fields in each doctype with same name and it automatically links without code.

Actually for me warrenty should appear in the screenshot I have attached. Once I select the Item warrenty also should come automatically.

Add the following in the quotation script
cur_frm.add_fetch(‘item_code’,‘warrenty’,‘warrenty’);
This ishould solve it

I have added the above code is Quotation and once tried in Quotation Item. Still issue not resolved.

Sorry in my case this is working. I’m running out of ideas.Just to be sure let us recap:

  1. you defined the custom field both in item and quotation item (type select)
    2 you put a value in this new field in the item screen
    3 you have added the line (cur_frm.add_fetch(‘item_code’,‘warrenty’,‘warrenty’):wink: in the script of quotation
    When all this is done you do a reload from here

    Then it is working in my case

@Rudi_Meylemans I have done with the steps which you told. If I done that it shows as in the screenshot. in this case I need to select the warenty period once I added the product.

Also, please find the screenshot of the script I added.

Apparently this is not working for a field type select. I changed the field type for warrenty on quotation item like this

You could even make the field on quotation item as read only. Leave the type select on the item. Remove the line from quotation script. And now it works.

1 Like

@Rudi_Meylemans Super. now its working fine. Thank you very much

Thank you
Your solution working like charm