[docs] removed the globals from documentation
This commit is contained in:
parent
89f7dd3c98
commit
11f0ee3cac
@ -3,8 +3,8 @@
|
||||
|
||||
frappe.ui.form.on("Event", "validate", function(frm) {
|
||||
if (frm.doc.from_date < get_today()) {
|
||||
msgprint(__("You can not select past date in From Date"));
|
||||
throw "past date selected"
|
||||
frappe.msgprint(__("You can not select past date in From Date"));
|
||||
frappe.throw(__("past date selected"))
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -4,12 +4,12 @@
|
||||
Fügen Sie dem Ereignis custom_before_cancel eine Steuerungsfunktion hinzu:
|
||||
|
||||
cur_frm.cscript.custom_before_cancel = function(doc) {
|
||||
if (user_roles.indexOf("Accounts User")!=-1 && user_roles.indexOf("Accounts Manager")==-1
|
||||
if (frappe.user_roles.indexOf("Accounts User")!=-1 && frappe.user_roles.indexOf("Accounts Manager")==-1
|
||||
&& user_roles.indexOf("System Manager")==-1) {
|
||||
if (flt(doc.grand_total) > 10000) {
|
||||
msgprint("You can not cancel this transaction, because grand total \
|
||||
frappe.msgprint("You can not cancel this transaction, because grand total \
|
||||
is greater than 10000");
|
||||
validated = false;
|
||||
frappe.validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
frappe.ui.form.on("Material Request", "validate", function(frm) {
|
||||
if(user=="user1@example.com" && frm.doc.purpose!="Material Receipt") {
|
||||
msgprint("You are only allowed Material Receipt");
|
||||
throw "Not allowed";
|
||||
frappe.msgprint("You are only allowed Material Receipt");
|
||||
frappe.throw(__("Not allowed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,16 @@
|
||||
|
||||
// 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",
|
||||
if(frappe.user_roles.indexOf("Material Manager")==-1) {
|
||||
var restricted_in_source = frappe.model.get_list("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"})
|
||||
var restricted_in_target = frappe.model.get_list("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;
|
||||
frappe.msgprint(__("Only Material Manager can make entry in Restricted Warehouse"));
|
||||
frappe.validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
frappe.ui.form.on("Task", "validate", function(frm) {
|
||||
if (frm.doc.from_date < get_today()) {
|
||||
msgprint(__("You can not select past date in From Date"));
|
||||
validated = false;
|
||||
frappe.msgprint(__("You can not select past date in From Date"));
|
||||
frappe.validated = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -3,12 +3,12 @@ Add a handler to `custom_before_cancel` event:
|
||||
|
||||
|
||||
cur_frm.cscript.custom_before_cancel = function(doc) {
|
||||
if (user_roles.indexOf("Accounts User")!=-1 && user_roles.indexOf("Accounts Manager")==-1
|
||||
if (frappe.user_roles.indexOf("Accounts User")!=-1 && frappe.user_roles.indexOf("Accounts Manager")==-1
|
||||
&& user_roles.indexOf("System Manager")==-1) {
|
||||
if (flt(doc.grand_total) > 10000) {
|
||||
msgprint("You can not cancel this transaction, because grand total \
|
||||
frappe.msgprint("You can not cancel this transaction, because grand total \
|
||||
is greater than 10000");
|
||||
validated = false;
|
||||
frappe.validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
frappe.ui.form.on("Material Request", "validate", function(frm) {
|
||||
if(user=="user1@example.com" && frm.doc.purpose!="Material Receipt") {
|
||||
msgprint("You are only allowed Material Receipt");
|
||||
throw "Not allowed";
|
||||
if(frappe.user=="user1@example.com" && frm.doc.purpose!="Material Receipt") {
|
||||
frappe.msgprint("You are only allowed Material Receipt");
|
||||
frappe.throw(__("Not allowed"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
|
||||
// restrict certain warehouse to Material Manager
|
||||
cur_frm.cscript.custom_validate = function(doc) {
|
||||
if(user_roles.indexOf("Material Manager")==-1) {
|
||||
if(frappe.user_roles.indexOf("Material Manager")==-1) {
|
||||
|
||||
var restricted_in_source = wn.model.get("Stock Entry Detail",
|
||||
var restricted_in_source = frappe.model.get_list("Stock Entry Detail",
|
||||
{parent:cur_frm.doc.name, s_warehouse:"Restricted"});
|
||||
|
||||
var restricted_in_target = wn.model.get("Stock Entry Detail",
|
||||
var restricted_in_target = frappe.model.get_list("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");
|
||||
frappe.msgprint(__("Only Material Manager can make entry in Restricted Warehouse"));
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user