diff --git a/frappe/public/js/frappe/misc/user.js b/frappe/public/js/frappe/misc/user.js index 9224e2756d..ee97b6889d 100644 --- a/frappe/public/js/frappe/misc/user.js +++ b/frappe/public/js/frappe/misc/user.js @@ -141,6 +141,19 @@ $.extend(frappe.user, { quote: quote }); } + }, + + /* Normally frappe.user is an object + * having properties and methods. + * But in the following case + * + * if (frappe.user === 'Administrator') + * + * frappe.user will cast to a string + * returning frappe.user.name + */ + toString: function() { + return this.name; } });