Skip to content

Instantly share code, notes, and snippets.

@rmehta
Created Feb 17, 2015
Embed
What would you like to do?
Frappe Version 5 Client Side API
// button click "Get Items"
frappe.ui.form.on("Stock Reconciliation", "get_items", function(frm) {
// prompt user for warehouse
frappe.prompt({label:"Warehouse", fieldtype:"Link", options:"Warehouse", reqd: 1},
function(data) {
// get latest balance and valuation rate
frappe.call({
method:"erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.get_items",
args: {warehouse: data.warehouse},
callback: function(r) {
// set the values in the item table
var items = [];
frm.clear_table("items");
for(var i=0; i< r.message.length; i++) {
var d = frm.add_child("items");
$.extend(d, r.message[i]);
}
frm.refresh_field("items");
}
});
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment