diff --git a/README.md b/README.md
index 87d1889151..199001550b 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ addon | version | maintainers | summary
--- | --- | --- | ---
[announcement](announcement/) | 18.0.1.0.1 | | Notify internal users about relevant organization stuff
[barcode_action](barcode_action/) | 18.0.1.0.0 | | Allows to use barcodes as a launcher
-[base_cancel_confirm](base_cancel_confirm/) | 18.0.1.0.1 |
| Base Cancel Confirm
+[base_cancel_confirm](base_cancel_confirm/) | 18.0.1.0.2 |
| Base Cancel Confirm
[base_custom_filter](base_custom_filter/) | 18.0.1.0.0 |
| Add custom filters in standard filters and group by dropdowns
[base_export_manager](base_export_manager/) | 18.0.1.0.2 | | Manage model export profiles
[base_import_security_group](base_import_security_group/) | 18.0.1.0.0 | | Group-based permissions for importing CSV files
diff --git a/base_cancel_confirm/README.rst b/base_cancel_confirm/README.rst
index faf20db14d..02da73d3bd 100644
--- a/base_cancel_confirm/README.rst
+++ b/base_cancel_confirm/README.rst
@@ -11,7 +11,7 @@ Base Cancel Confirm
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- !! source digest: sha256:fae0ef1c6d1dd76aad220b3620639cbafd2aa06efca75a41d0476c706db7b068
+ !! source digest: sha256:3a1d5474e16df8a851d39ec3b5fb9929ab4c6f2990e0eac80c1ca56145dfc43e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
diff --git a/base_cancel_confirm/__manifest__.py b/base_cancel_confirm/__manifest__.py
index f3a5567138..95a19386dd 100644
--- a/base_cancel_confirm/__manifest__.py
+++ b/base_cancel_confirm/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Base Cancel Confirm",
- "version": "18.0.1.0.1",
+ "version": "18.0.1.0.2",
"author": "Ecosoft,Odoo Community Association (OCA)",
"category": "Usability",
"license": "AGPL-3",
diff --git a/base_cancel_confirm/model/base_cancel_confirm.py b/base_cancel_confirm/model/base_cancel_confirm.py
index 7b0278e09b..dc296bda65 100644
--- a/base_cancel_confirm/model/base_cancel_confirm.py
+++ b/base_cancel_confirm/model/base_cancel_confirm.py
@@ -49,8 +49,11 @@ def open_cancel_confirm_wizard(self):
}
return action
+ def _get_value_clear_cancel(self):
+ return {"cancel_confirm": False, "cancel_reason": False}
+
def clear_cancel_confirm_data(self):
- self.write({"cancel_confirm": False, "cancel_reason": False})
+ self.write(self._get_value_clear_cancel())
def get_view(self, view_id=None, view_type="form", **options):
res = super().get_view(view_id=view_id, view_type=view_type, **options)
diff --git a/base_cancel_confirm/static/description/index.html b/base_cancel_confirm/static/description/index.html
index c84ee47194..c0716061a4 100644
--- a/base_cancel_confirm/static/description/index.html
+++ b/base_cancel_confirm/static/description/index.html
@@ -372,7 +372,7 @@
Many document model that already has cancel action may also want a diff --git a/base_cancel_confirm/wizard/cancel_confirm.py b/base_cancel_confirm/wizard/cancel_confirm.py index c5c80b27c0..50aee0cfdb 100644 --- a/base_cancel_confirm/wizard/cancel_confirm.py +++ b/base_cancel_confirm/wizard/cancel_confirm.py @@ -18,15 +18,21 @@ class CancelConfirm(models.TransientModel): required=True, ) + def _get_dict_update(self): + """Hooks this method to update value in docs""" + dict_update = {"cancel_confirm": True} + # Cancel Reason + if self.has_cancel_reason in ["optional", "required"]: + dict_update.update({"cancel_reason": self.cancel_reason}) + return dict_update + def confirm_cancel(self): self.ensure_one() res_model = self._context.get("cancel_res_model") res_ids = self._context.get("cancel_res_ids") cancel_method = self._context.get("cancel_method") docs = self.env[res_model].browse(res_ids) - docs.write({"cancel_confirm": True}) - # Cancel Reason - if self.has_cancel_reason in ["optional", "required"]: - docs.write({"cancel_reason": self.cancel_reason}) + dict_update = self._get_dict_update() + docs.write(dict_update) res = getattr(docs, cancel_method)() return res