Custom Script not working

Hi,

Could someone help me out with this code:

frappe.ui.form.on('Quotation Item', 'item_code', function(frm, cdt, cdn){
    frappe.call({
        'method': 'frappe.client.get_value',
        'args': {
            'doctype': 'Item',
            'filters': [
                ['Item', 'item_code', '=', locals[cdt][cdn].item_code]
            ],
           'fieldname':'item_description'
        },
        'callback': function(res){
            frappe.mode.set_value(cdt, cdn, 'item_description', res.message.item_description);
        }
    });
});

I’m trying to get the data under item description from my Item to populate item description under Quotation Item.

The same code has worked item_name weirdly.

Thank You!

The field for item’s description is just ‘description’ rather than ‘item_description’. Give that a try!

Hi @alec_ruizramon1,

I forgot to mention that they were custom fields.

But I’ll try the default fields as well.

@alec_ruizramon1,

The description field is linked even without the script, so something is probably wrong with the script.
Now i need to figure out how to change the description field to data field.

Thanks!

write script on Quotation instead of Quotation Item

Hi @kolate_sambhaji,

No luck with that.

But I’ve managed to map the default description boxes.

Thanks for your help!

frappe.model.set_value

someone should pay me to catch typos :stuck_out_tongue:

2 Likes