Skip to content

Instantly share code, notes, and snippets.

@rmehta
Created December 2, 2013 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmehta/7751058 to your computer and use it in GitHub Desktop.
Save rmehta/7751058 to your computer and use it in GitHub Desktop.
cur_frm.cscript.custom_validate = function(doc) {
var items = wn.model.get("Delivery Note Item", {parent: doc.name})
var items_against_sales_order = $.map(items, function(d) { return d.against_sales_order ? d : null })
if(items.length > items_against_sales_order.length && user_roles.indexOf(["Allowed Role"])===-1) {
wn.msgprint("Please make against sales order");
throw "Not allowed";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment