A useful tutorial for option 5
I agree that you cannot add anything to Portal Settings directly. Yes, you would have to either use hooks, or fork the repository.
However, there is a section āCustom Sidebar Menuā. I suppose you could build your own sidebar here, then click āHide Standard Buttonā checkbox near the top of the page.
Iām just making guesses; Iāve never used this feature. But since it contained the word āPortalā, I included it in my overview.
Iām not sure. Although Iāve worked on ERPNext a long time, Iāve barely done any work with Pages. Iām not a strong Frontend by nature. So I find the Pages very difficult to figure out.
@ahassoun Thanks for sharing that YouTube tutorial on Pages, I will check that out!
I have no experience with Frappe UI. Itās not part of Frappe Framework and ERPNext yet, is it?
Regarding custom Page (5th option) server-side coding in Python:
Assuming you have a custom App with the name myapp and defined a custom Page with the name mypage
Then you should have a directory ā¦/apps/myapp/myapp/myapp/page/mypage/
with mypage.json and mypage.js
Edit the mypage.js
frappe.pages['mypage'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'mypage',
single_column: true
});
page.add_inner_button('User Detail', () => js_detail());
function js_detail() {
frappe.call({
method: 'myapp.myapp.page.mypage.mypage.py_detail',
args: {name: frappe.session.user},
callback: function(r) {
console.log(r.message);
frappe.msgprint('<pre>' + JSON.stringify(r.message.User[0], null, 2) + '</pre>');
}
});
};
}
Create a .py in ā¦/apps/myapp/myapp/myapp/page/mypage/mypage.py
and place this code in it
import frappe
@frappe.whitelist()
def py_detail(name):
user = frappe.db.sql("""select * from `tabUser` where name = %s""",name, as_dict=1)
return {'User':user}
Caveat : I have not tested this code !
@brian_pond
Thanks for the explanation.
We hope to see more explanation updates in Frappe documentation as well as the rapid development and new versions growing up.
The code does work