Stock Reconciliation Child Table Row Data

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 ?


  1. 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
https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/payment_entry/payment_entry.js#L465-L489

@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

@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 ?