Trying to create a new feature for Frappe framework.
Use Case:
When the user is editing a record in a certain doctype and He/She decided to transfer to any other menu and the doctype status is not save
it will warning popup to save or cancel. If he chooses to save it the record is save.
Why we need this?
I let user try ERPNext and one of the problem they found is sometimes they forgot to click save and they have already encoded lots of record and specially a lot of record in a child table (e.g. Sales Order and Sales Order Line) and they transfer to another tab all they encoded is GONE
@max_morais_dmm Maybe you have a comment on this you are javascript guro
I think a better way to handle this is to show Unsaved documents in the List view instead of showing an annoying popup every time. This will also save us from adding that extra configuration option. This might be tricky but would have the right UX.
Before closing a tab, the code should look for any unsaved document and warn the user about it. If the user tries to do a full refresh or close the tab, show pop up that following documents are unsaved. Are you sure you still want to refresh/close?
Note:
All opened documents are already saved on the client side in window.locals (better api is frappe.model.get)