Session Defaults form popup

Hi Everyone,
I have a query about session defaults what I want is when the user logs into the system every time the first thing is system should popup the session defaults form.
How I can do this?

There is a hook in python called boot_session
add a flag in boot_session with name

default_popup = 1

this boot will give access to this variable in JS

frappe.boot.default_popup

make a script in custom app and add it in hook called

app_include_js

and write your code
upon success show update this boot_session variable to 0

2 Likes

Actually I don’t know much about coding can you please guide me a little bit more in this…
Thanks

What is your use case?

Please look at these pictures…


when we login to the system this is homepage for ERPNEXT and if I want to setup session default I need to select my profile and then the system shows the session default column like this…

and when I click on this session default field a form will popup…

what I want is when the user login into the system every time the first thing is system should popup this session default form…

We usually create 2 users for each company. So their respective companies are default.

To show that form when the user logged in, you should use hooks.py. There is an event for that which you can trigger that form.

Can you please tell me about it in some detail because I am new in this…

For the first method, you can create 2 users and create User Permission for the company field.

For the second method, you need to create your custom app. And in your hooks.py file, you can execute your custom code in the login event. Docs: Hooks.

Clone and Install

sudo bench get-app GitHub - AlshaheerSoft2050/spherapp14: Show Session Defaults form popup after user Success login