Browse Source

Merge pull request #847 from EssentNovaTeam/feature/8.0/web_copy_confirm

[ADD] Ask for confirmation when copying records
pull/283/merge
Moises Lopez - https://www.vauxoo.com/ 7 years ago
committed by GitHub
parent
commit
f0773760ed
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 55
      web_copy_confirm/README.rst
  2. 0
      web_copy_confirm/__init__.py
  3. 19
      web_copy_confirm/__openerp__.py
  4. 15
      web_copy_confirm/static/src/js/web_copy_confirm.js
  5. 10
      web_copy_confirm/views/assets.xml

55
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
<https://github.com/OCA/web/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Stefan Rijnhart <stefan@opener.amsterdam>
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.

0
web_copy_confirm/__init__.py

19
web_copy_confirm/__openerp__.py

@ -0,0 +1,19 @@
# coding: utf-8
# Copyright (C) 2018 DynApps <http://www.dynapps.be>
# @author Stefan Rijnhart <stefan@opener.amsterdam>
# 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,
}

15
web_copy_confirm/static/src/js/web_copy_confirm.js

@ -0,0 +1,15 @@
// Copyright (C) 2018 DynApps <http://www.dynapps.be>
// @author Stefan Rijnhart <stefan@opener.amsterdam>
// 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);
}
});
}
});
};

10
web_copy_confirm/views/assets.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp><data>
<template id="assets_backend" name="web_copy_confirm assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_copy_confirm/static/src/js/web_copy_confirm.js"></script>
</xpath>
</template>
</data></openerp>
Loading…
Cancel
Save