<!-- TO print current logged in user email id -->
<div class="row">
<div class="col-xs-5 text-right"><big><b>Print By(email id)</b> </big></div>
<div class="col-xs-7 "><big>{{ frappe.user }} </big> </div>
</div>
<!-- TO print current logged in user fist name -->
{% set u = frappe.get_doc("User", frappe.user) %}
<div class="row">
<div class="col-xs-5 text-right"><big><b>Print By(user name)</b> </big></div>
<div class="col-xs-7 "><big>{{ u.first_name }} </big> </div>
</div>
Wednesday, 9 September 2015
display current logged in user name and data in ERPNext/Frappe Print Format
Monday, 7 September 2015
hiding fields based on some condition
To hide fields on form
frappe.ui.form.on("Quotation", "onload", function(frm) {
cur_frm.set_df_property("shipping_rule", "hidden",true);
msgprint("hi");
});
To hide fields in child table:
frappe.ui.form.on("Quotation", "onload", function(frm) {
//cur_frm.set_df_property("shipping_rule", "hidden",true);
cur_frm.fields_dict["items"].grid.set_column_disp('description', false)
msgprint("hi");
});
TO held fileds in table, you can use eval property of field
eval:doc.item_code == "sample item"
eval:doc.item_code.substr(0,3)== "720"
frappe.ui.form.on("Quotation", "onload", function(frm) {
cur_frm.set_df_property("shipping_rule", "hidden",true);
msgprint("hi");
});
To hide fields in child table:
frappe.ui.form.on("Quotation", "onload", function(frm) {
//cur_frm.set_df_property("shipping_rule", "hidden",true);
cur_frm.fields_dict["items"].grid.set_column_disp('description', false)
msgprint("hi");
});
TO held fileds in table, you can use eval property of field
eval:doc.item_code == "sample item"
eval:doc.item_code.substr(0,3)== "720"
Substring in javascript
Substring in Javascript:
The substr() method returns the characters in a string beginning at the specified location through the specified number of characters.
frappe.ui.form.on("Quotation", "validate", function(frm) {
var a = frm.doc.customer;
a= a.substr(0,3);
msgprint(a);
});
Above script returns first three letter of customer name.
reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
The substr() method returns the characters in a string beginning at the specified location through the specified number of characters.
Syntax
str.substr(start[, length])
Frappe Example frappe.ui.form.on("Quotation", "validate", function(frm) {
var a = frm.doc.customer;
a= a.substr(0,3);
msgprint(a);
});
Above script returns first three letter of customer name.
reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
Subscribe to:
Posts (Atom)