diff --git a/web_copy_confirm/README.rst b/web_copy_confirm/README.rst new file mode 100644 index 00000000..f347116c --- /dev/null +++ b/web_copy_confirm/README.rst @@ -0,0 +1,55 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================================================= +Show a confirmation dialogue when copying records +================================================= + +This module will show a confirmation dialog when the user selects the +`Duplicate` option from the `More` dropdown in the standard form view. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/8.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Stefan Rijnhart + +Do not contact contributors directly about support or help with technical issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_copy_confirm/__init__.py b/web_copy_confirm/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_copy_confirm/__openerp__.py b/web_copy_confirm/__openerp__.py new file mode 100644 index 00000000..2e345a1e --- /dev/null +++ b/web_copy_confirm/__openerp__.py @@ -0,0 +1,19 @@ +# coding: utf-8 +# Copyright (C) 2018 DynApps +# @author Stefan Rijnhart +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Show confirmation dialogue before copying records", + "version": "8.0.1.0.0", + "author": "Dynapps,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "category": "Tools", + "depends": [ + 'web', + ], + "data": [ + "views/assets.xml", + ], + "installable": True, +} diff --git a/web_copy_confirm/static/src/js/web_copy_confirm.js b/web_copy_confirm/static/src/js/web_copy_confirm.js new file mode 100644 index 00000000..3d7859fd --- /dev/null +++ b/web_copy_confirm/static/src/js/web_copy_confirm.js @@ -0,0 +1,15 @@ +// Copyright (C) 2018 DynApps +// @author Stefan Rijnhart +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +openerp.web_copy_confirm = function(instance) { + instance.web.FormView.include({ + on_button_duplicate: function() { + var self = this; + this.has_been_loaded.done(function() { + if (confirm(_t("Do you really want to copy this record?"))) { + return self._super.apply(self, arguments); + } + }); + } + }); +}; diff --git a/web_copy_confirm/views/assets.xml b/web_copy_confirm/views/assets.xml new file mode 100644 index 00000000..af0fab4a --- /dev/null +++ b/web_copy_confirm/views/assets.xml @@ -0,0 +1,10 @@ + + + + + +