diff --git a/auto_save_restrict/__manifest__.py b/auto_save_restrict/__manifest__.py index dff3d3c31..58775076e 100644 --- a/auto_save_restrict/__manifest__.py +++ b/auto_save_restrict/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################# { 'name': 'Auto Save Restrict', - 'version': '18.0.1.0.0', + 'version': '18.0.1.1.0', 'category': 'Extra Tools', 'summary': """Restrict auto save in all models""", 'description': 'Using this module,we can restrict' @@ -38,6 +38,8 @@ 'auto_save_restrict/static/src/js/form_controller.js', 'auto_save_restrict/static/src/js/list_controller.js', 'auto_save_restrict/static/src/js/list_renderer.js', + 'auto_save_restrict/static/src/js/view_button.js', + ], }, 'images': ['static/description/banner.jpg'], diff --git a/auto_save_restrict/doc/RELEASE_NOTES.md b/auto_save_restrict/doc/RELEASE_NOTES.md index a415b4565..a9790d019 100644 --- a/auto_save_restrict/doc/RELEASE_NOTES.md +++ b/auto_save_restrict/doc/RELEASE_NOTES.md @@ -5,3 +5,7 @@ #### ADD - Initial commit for Auto Save Restrict +#### 30.04.2025 +#### Version 18.0.1.1.0 +#### UPDATE +- Auto save restrict for smart button diff --git a/auto_save_restrict/static/description/assets/screenshots/ss3.png b/auto_save_restrict/static/description/assets/screenshots/ss3.png new file mode 100644 index 000000000..e193d81ac Binary files /dev/null and b/auto_save_restrict/static/description/assets/screenshots/ss3.png differ diff --git a/auto_save_restrict/static/description/index.html b/auto_save_restrict/static/description/index.html index 307d83784..dcd44791a 100644 --- a/auto_save_restrict/static/description/index.html +++ b/auto_save_restrict/static/description/index.html @@ -425,6 +425,35 @@ +
+
+
+
+

+ In + + Smart button +

+
+
+

+ The user will see a popup when clicking the smart button, asking whether they want to save their changes that made in the form view. +

+
+
+
+ +
+
+
+
+
+ pick(model, "context", "evalContext", "resModel", "resId", "resIds"), + }); + }, + + async _confirmSave() { + let _continue = true; + + await new Promise((resolve) => { + this.dialogService.add(SettingsConfirmationDialog, { + body: _t("Would you like to save your changes?"), + confirm: async () => { + // Check if `clickParams` is available + const clickParams = this.clickParams || { + name: "execute", + type: "object", + }; + + const model = this.props.record || this.props.model; + if (model) { + await this.env.onClickViewButton({ + clickParams, + getResParams: () => + pick( + model, + "context", + "evalContext", + "resModel", + "resId", + "resIds" + ), + }); + } else { + console.warn("No model available to execute save."); + } + + _continue = true; + resolve(); + }, + cancel: async () => { + const model = this.props.record || this.props.model; + if (model) { + await model?.discard?.(); + await model?.save?.(); + } else { + console.warn("No model available to discard or save."); + } + _continue = true; + resolve(); + }, + stayHere: () => { + _continue = false; + resolve(); + }, + }); + }); + + return _continue; + }, +});