[SOLVED] [V7] How to set one field based on another one

Hello,

Is it possible in the cloud version to fill the “Default warehouse” field based on the “Item Group”? If so, how?

Thanks,
Nuno

http://frappe.github.io/erpnext/user/manual/en/customize-erpnext/custom-scripts/custom-script-examples/

frappe.ui.form.on('Sales Order Item', 'item_code', function(frm, doctype, name) {
  var row = frappe.get_doc(doctype, name);
  if(row.item_group == 'A') row.warehouse = 'X';
  if(row.item_group == 'B') row.warehouse = 'Y';
  frm.refresh_field('items')
});
3 Likes

This topic was automatically closed after 24 hours. New replies are no longer allowed.