I am trying to fetch “pincode” field from address doctype into Sales order custom field “pincode”.
Address of the customer is loading automatically once we select the customer name. But particularly i need “pincode” field.
I have used this code “cur_frm.add_fetch(“customer_address”, “pincode”, “pincode”);” but this didn’t work for me.
i tried this piece of code also
frappe.ui.form.on(‘Sales Order’, ‘customer_address’, function(frm, cdt, cdn){
frappe.call({
‘method’: ‘frappe.client.get_value’,
‘args’: {
‘doctype’: ‘Address’,
‘filters’: [
[‘Address’, ‘customer_address’, ‘=’, locals[cdt][cdn].customer_address]
],
‘fieldname’:‘pincode’
},
‘callback’: function(res){
frappe.mode.set_value(cdt, cdn, ‘pincode’, res.message.pincode);
}
});
});
But this code is generating an error “OperationalError: (1241, ‘Operand should contain 1 column(s)’)” .
Please give me suggestions to rectify these errors.