Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 109 |
Technical Name |
web_no_auto_save |
License | LGPL-3 |
Website | http://www.bizzappdev.com |
Versions | 16.0 17.0 18.0 |
Availability |
Odoo Online
Odoo.sh
On Premise
|
Lines of code | 109 |
Technical Name |
web_no_auto_save |
License | LGPL-3 |
Website | http://www.bizzappdev.com |
Versions | 16.0 17.0 18.0 |
Contact Us for the smart Personalized Modules.
This module allows to Not auto save for any changes in the Tree as well as Form view for any module and ask for the Do you want to save changes Automatically? on the previous click.
Increase the visibility of Save and Discard button

When changes in the record and go previous without save than it will open the Confirmation Dialogue(Message)

On click of OK button click the record changes save


On click of Cancel button record doesn't have any changes


Increase the visibility of Save and Discard button for Enterprise

When changes in the record and go previous without save than it will open the Confirmation Dialogue(Message) for Enterprise

On click of OK button click the record changes save for Enterprise


On click of Cancel button record doesn't have any changes for Enterprise



Please log in to comment on this module
Report comment
Any abuse of this reporting system will be penalizedusing deepSeek I modified it .It is working well except when clicking menu item it saves automatically
/** @odoo-module **/ import { FormController } from "@web/views/form/form_controller"; import { ListController } from "@web/views/list/list_controller"; import { ViewButton } from "@web/views/view_button/view_button"; import { useRef } from "@odoo/owl"; import { useSetupView } from "@web/views/view_hook"; import { useService } from "@web/core/utils/hooks"; import { _t } from "@web/core/l10n/translation"; import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; // Helper function for new stay-on-record dialog async function showStayDialog(dialog) { return new Promise((resolve) => { dialog.add(ConfirmationDialog, { body: _t("There are unsaved changes. Please save them first."), confirmLabel: _t("OK"), cancel: null, // Remove cancel button confirm: resolve.bind(null, false), // Always return false to stay }); }); } const oldSetup = FormController.prototype.setup; const oldonPagerUpdated = FormController.prototype.onPagerUpdate; const Formsetup = function () { this.dialog = useService("dialog"); this.rootRef = useRef("root"); useSetupView({ beforeLeave: async () => { if (this.model.root.dirty) { await showStayDialog(this.dialog); return false; // Prevent leaving } }, }); const result = oldSetup.apply(this, arguments); return result; }; FormController.prototype.setup = Formsetup; const onPagerUpdate = async function () { const dirty = await this.model.root.isDirty(); if (dirty) { await showStayDialog(this.dialog); return false; // Prevent pager update } return oldonPagerUpdated.apply(this, arguments); }; FormController.prototype.onPagerUpdate = onPagerUpdate; const oldCreate = FormController.prototype.create; FormController.prototype.create = async function () { if (this.model.root.dirty) { await showStayDialog(this.dialog); return false; // Prevent create } return oldCreate.apply(this, arguments); }; const oldshouldExecuteAction = FormController.prototype.shouldExecuteAction; FormController.prototype.shouldExecuteAction = async function () { if (this.model.root.dirty) { await showStayDialog(this.dialog); return false; // Prevent action execution } return oldshouldExecuteAction.apply(this, arguments); }; const ListSuper = ListController.prototype.setup; const Listsetup = function () { this.dialog = useService("dialog"); useSetupView({ rootRef: this.rootRef, beforeLeave: async () => { const list = this.model.root; const editedRecord = list.editedRecord; if (editedRecord && editedRecord.isDirty) { await showStayDialog(this.dialog); return false; // Prevent leaving } }, }); const result = ListSuper.apply(this, arguments); return result; }; ListController.prototype.setup = Listsetup; const oldonClick = ViewButton.prototype.onClick; ViewButton.prototype.onClick = async function () { if (this.props.record.dirty) { await showStayDialog(this.dialog); return false; // Prevent button action } return oldonClick.apply(this, arguments); };