Hello,
I have the following script:
let load_prices = function(frm, cdt, cdn) {
var child = locals[cdt][cdn];frappe.call({
method: ‘frappe.client.get_list’,
args: {
‘doctype’: ‘Item Price’,
‘filters’: {‘item_code’: child.item_code},
‘fields’: [‘currency’, ‘price_list_rate’],
},
callback: function(data) {
var prices = ;
var money = new Intl.NumberFormat(‘de-DE’, { style: ‘currency’, currency: ‘RUB’ });(data.message || []).forEach(function(row) { prices.push({ 'value': row.price_list_rate, //'label': row.price_list_rate + " " + row.currency 'label': money.format(row.price_list_rate) }); }); frappe.meta.get_docfield('Opportunity Item', 'prices', cur_frm.doc.name).options = prices; frm.refresh_field('items'); }
});
};
I am getting data in prices (array(‘label’: label_text, ‘value’: value_text))
But I am unable to load this data into SelectField with name ‘prices’
(this is line no worked):
frappe.meta.get_docfield('Opportunity Item', 'prices', cur_frm.doc.name).options = prices;
This script worked in ERPNext12.
I used this is:
[Tutorial] set_df_property for child table fields?