Skip to content

Instantly share code, notes, and snippets.

@Meshugah
Created April 15, 2020 10:41
Show Gist options
  • Save Meshugah/38d797351f14c795dedf63ee52d9e50a to your computer and use it in GitHub Desktop.
Save Meshugah/38d797351f14c795dedf63ee52d9e50a to your computer and use it in GitHub Desktop.
Stock entry gist
// // All rounded up values in kilos
// itemTransferMinimums = {
// 'Fastner': '2000'
// }
// function myround(x, roundUp){
// return base * Math.ceil(x/roundUp);
// }
// frappe.ui.form.on('Stock Entry', {
// before_save(frm,cdt,cdn) {
// var items = frm.doc.items;
// for(var i = 0; i< items.length; i++){
// if(items[i].s_warehouse == 'Stores - VTK'){
// // BIG IF haha, only do this based on if it is necessary
// // ROUND UP MATH
// itemTransferMinimums[items[i].item_name] // value that needs to be rounded up to.
// // SET_VALUE
// frappe.model.set_value(cur_frm.doc.items[i].doctype, cur_frm.doc.items[i].name, 'qty', roundedValue);
// console.log(items[i].qty); // <- how do set the value of this item in this table?
// }
// }
// }
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment