jcyh
June 7, 2017, 10:51am
1
I have been tried a lot of default load all the stock reconciliation items in the child table.
Unfortunately, i am not manage to get what i want. How can i achieve this ?
As you can see the add_child function , has add another row for the child table ? how can i load all the items and set the warehouse link field?
Hi @jcyh
Add code cur_frm.set_value('items', [])
before the code var child = cur_frm.add_child('items', {"item_code":"P6M"})
To load all items and warehouse you need to pass it under add_child method one by one. For more details please refer the below code
},
() => {
if(callback_function) callback_function(frm);
frm.events.hide_unhide_fields(frm);
frm.events.set_dynamic_labels(frm);
}
]);
}
}
});
}
},
paid_from_account_currency: function(frm) {
if(!frm.doc.paid_from_account_currency || !frm.doc.company) return;
let company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
if (frm.doc.paid_from_account_currency == company_currency) {
frm.set_value("source_exchange_rate", 1);
This file has been truncated. show original
jcyh
June 7, 2017, 11:20am
3
@rohit_w , Thank you very much of your replied. How can i add the warehouse link field ? is it similar using like this :
frappe.model.set_value(child.doctype, child.name, "warehouse", sessionAttendedWarehouse);
the sessionAttendedWarehouse is session set from backend pass back.
Hi @jcyh
Use below code
var c = frm.add_child("items");
c.item_code = "P6M"
c.warehouse = warehouse_name
refresh_field('items')
1 Like
jcyh
June 8, 2017, 2:52am
6
@rohit_w , what is best way to implement to default load all items , warehouse and the quantity of items.
i did like attached photo below but the quantity isn’t correct here… I know this is not a good implementation, but i do not know the best of doing it.
i guess the quantity showing as 0 is something to cause by this code in the following which get latest quantity from stock ledger, but i do not understand it… can u please share with me ?