Hi,
I have written some code on selection of quantity from table1
frappe.call({
method: "library.update_items.get_items_from_product_set_details",
args: d1,
callback: function(r) {
$.each(r.message, function(i, item) {
var new_row = frm.add_child("items");
new_row.item_code = item.item_code;
new_row.item_name = item.item_name;
new_row.description = item.description;
new_row.warehouse = "India Finished Goods - miSport";
new_row.uom = item.stock_uom;
new_row.conversion_factor = 1;
new_row.stock_quantity = 1;
new_row.qty = item.qty*d.quantity;
new_row.rate = 0;
new_row.amount = 0;
new_row.product_type = d.product_name;
});
refresh_field("items");
}
});
This is how it looks like after this code:
And then I have written another code on the value change event of table2
var new_row1 = frm.add_child("items");
new_row1.item_code = item.item_code;
new_row1.item_name = item.item_name;
new_row1.description = item.description;
new_row1.warehouse = "India Finished Goods - miSport";
new_row1.uom = item.stock_uom;
new_row1.conversion_factor = 1;
new_row1.stock_quantity = 1;
new_row1.qty = item.accessories;
new_row1.rate = 0;
new_row1.amount = 0;
new_row1.product_type = "accessories";
refresh_field("items");
This is how it looks like after the above code:
Issue is with refresh_field("items");
If I do refresh_field("items");
then other items goes off and if I do not do refresh_field("items");
then the item details added in the last row doesn’t get display.
NOTE: Till the time data hasn’t be saved in database and document is still in the New Sales Order 1 Stage.
Any idea how this problem can be resolved?
Regards
Ruchin Sharma