Browse Source

Mar 26: [FIX] Bug Fixed 'auto_save_restrict'

pull/313/head
RisvanaCybro 1 year ago
parent
commit
d400e58317
  1. 6
      auto_save_restrict/doc/RELEASE_NOTES.md
  2. 5
      auto_save_restrict/static/src/js/form_controller.js
  3. 5
      auto_save_restrict/static/src/js/list_controller.js

6
auto_save_restrict/doc/RELEASE_NOTES.md

@ -4,3 +4,9 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial commit for Auto Save Restrict - Initial commit for Auto Save Restrict
#### 19.03.2024
#### Version 17.0.1.0.1
##### BUG FIX
- Updated the module by removing the auto save option while reloading
the page in form and tree.

5
auto_save_restrict/static/src/js/form_controller.js

@ -2,13 +2,13 @@
import { FormController } from "@web/views/form/form_controller"; import { FormController } from "@web/views/form/form_controller";
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
import { useSetupView } from "@web/views/view_hook"; import { useSetupView } from "@web/views/view_hook";
patch(FormController.prototype, { patch(FormController.prototype, {
/* Patch FormController to restrict auto save in form views */ /* Patch FormController to restrict auto save in form views */
setup(){ setup(){
super.setup(...arguments); super.setup(...arguments);
useSetupView({ useSetupView({
beforeLeave: () => this.beforeLeave(), beforeLeave: () => this.beforeLeave(),
beforeUnload: (ev) => this.beforeUnload(ev),
}); });
}, },
async beforeLeave() { async beforeLeave() {
@ -23,5 +23,8 @@ patch(FormController.prototype, {
this.discard(); this.discard();
} }
} }
},
beforeUnload: async (ev) => {
ev.preventDefault();
} }
}); });

5
auto_save_restrict/static/src/js/list_controller.js

@ -2,13 +2,13 @@
import { ListController } from '@web/views/list/list_controller'; import { ListController } from '@web/views/list/list_controller';
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
import { useSetupView } from "@web/views/view_hook"; import { useSetupView } from "@web/views/view_hook";
patch(ListController.prototype, { patch(ListController.prototype, {
/* Patch ListController to restrict auto save in tree views */ /* Patch ListController to restrict auto save in tree views */
setup(){ setup(){
super.setup(...arguments); super.setup(...arguments);
useSetupView({ useSetupView({
beforeLeave: () => this.beforeLeave(), beforeLeave: () => this.beforeLeave(),
beforeUnload: (ev) => this.beforeUnload(ev),
}); });
}, },
async beforeLeave() { async beforeLeave() {
@ -19,5 +19,8 @@ patch(ListController.prototype, {
this.onClickDiscard(); this.onClickDiscard();
} }
} }
},
beforeUnload: async (ev) => {
ev.preventDefault();
} }
}); });

Loading…
Cancel
Save