[docs] custom script examples, [build] move CMS make to app via event_handlers.on_build

This commit is contained in:
Rushabh Mehta
2013-09-03 17:04:05 +05:30
parent 4263344cd2
commit d50d924ee5
12 changed files with 190 additions and 11 deletions

View File

@@ -0,0 +1,22 @@
---
{
"_label": "Restrict User Based on Child Record (Warehouse)"
}
---
// restrict certain warehouse to Material Manager
cur_frm.cscript.custom_validate = function(doc) {
if(user_roles.indexOf("Material Manager")==-1) {
var restricted_in_source = wn.model.get("Stock Entry Detail",
{parent:cur_frm.doc.name, s_warehouse:"Restricted"});
var restricted_in_target = wn.model.get("Stock Entry Detail",
{parent:cur_frm.doc.name, t_warehouse:"Restricted"})
if(restricted_in_source.length || restricted_in_target.length) {
msgprint("Only Material Manager can make entry in Restricted Warehouse");
validated = false;
}
}
}