diff --git a/setup/web_tree_duplicate/odoo/addons/web_tree_duplicate b/setup/web_tree_duplicate/odoo/addons/web_tree_duplicate new file mode 120000 index 000000000..439c853d8 --- /dev/null +++ b/setup/web_tree_duplicate/odoo/addons/web_tree_duplicate @@ -0,0 +1 @@ +../../../../web_tree_duplicate \ No newline at end of file diff --git a/setup/web_tree_duplicate/setup.py b/setup/web_tree_duplicate/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_tree_duplicate/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_tree_duplicate/README.rst b/web_tree_duplicate/README.rst new file mode 100644 index 000000000..305a677d6 --- /dev/null +++ b/web_tree_duplicate/README.rst @@ -0,0 +1,121 @@ +=========================== +Tree View Duplicate Records +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f76ad85d67cf363cb525bf60998a317d0f9a114ebe4ecc6685dae79cc5b0465e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/16.0/web_tree_duplicate + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_tree_duplicate + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +With this module you can duplicate records directly from the tree view. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +The duplicate option is enabled by default. +To disable it you have to add attribute `duplicate` to the tree view. +Set `duplicate` to `false` to enable it or `true` to (explicitly) disable it. + +Example: + +.. code-block:: xml + + + + + res.users + + + + false + + + + + +Usage +===== + +To use this module, you need to: + +#. Go to any tree view; +#. select some records; +#. open the sidebar menu and click 'Duplicate'. + +.. image:: https://raw.githubusercontent.com/web_tree_duplicate/static/description/screenshot-duplicate.png + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Hunki Enterprises BV +* Onestein + +Contributors +~~~~~~~~~~~~ + +* Dennis Sluijk +* Holger Brunn (https://hunki-enterprises.com) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-tarteo| image:: https://github.com/tarteo.png?size=40px + :target: https://github.com/tarteo + :alt: tarteo + +Current `maintainer `__: + +|maintainer-tarteo| + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_tree_duplicate/__init__.py b/web_tree_duplicate/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web_tree_duplicate/__manifest__.py b/web_tree_duplicate/__manifest__.py new file mode 100644 index 000000000..73a206255 --- /dev/null +++ b/web_tree_duplicate/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Onestein +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Tree View Duplicate Records", + "summary": "Duplicate records directly from the tree view.", + "development_status": "Beta", + "category": "Extra Tools", + "version": "16.0.1.0.0", + "author": "Hunki Enterprises BV, Onestein, Odoo Community Association (OCA)", + "license": "AGPL-3", + "website": "https://github.com/OCA/web", + "depends": ["web"], + "maintainers": ["tarteo"], + "assets": { + "web.assets_backend": [ + "web_tree_duplicate/static/src/web_tree_duplicate.esm.js", + ], + }, +} diff --git a/web_tree_duplicate/i18n/ca.po b/web_tree_duplicate/i18n/ca.po new file mode 100644 index 000000000..08a29df1e --- /dev/null +++ b/web_tree_duplicate/i18n/ca.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-02-17 10:45+0000\n" +"Last-Translator: claudiagn \n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "Duplicar" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "Registres duplicats" diff --git a/web_tree_duplicate/i18n/es.po b/web_tree_duplicate/i18n/es.po new file mode 100644 index 000000000..c1fba31a1 --- /dev/null +++ b/web_tree_duplicate/i18n/es.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-23 14:19+0000\n" +"Last-Translator: claudiagn \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "Duplicar" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "Registros duplicados" diff --git a/web_tree_duplicate/i18n/fr.po b/web_tree_duplicate/i18n/fr.po new file mode 100644 index 000000000..7dcfaa3e8 --- /dev/null +++ b/web_tree_duplicate/i18n/fr.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-02-01 12:44+0000\n" +"Last-Translator: Yann Papouin \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "Dupliquer" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "Enregistrements dupliqués" diff --git a/web_tree_duplicate/i18n/he_IL.po b/web_tree_duplicate/i18n/he_IL.po new file mode 100644 index 000000000..92ea362ad --- /dev/null +++ b/web_tree_duplicate/i18n/he_IL.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-05 08:47+0000\n" +"PO-Revision-Date: 2023-07-05 08:47+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_tree_duplicate +#. odoo-javascript +#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0 +#, python-format +msgid "Duplicate" +msgstr "שכפול" + +#. module: web_tree_duplicate +#. odoo-javascript +#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0 +#, python-format +msgid "Duplicated Records" +msgstr "רשומות משוכפלות" diff --git a/web_tree_duplicate/i18n/pt.po b/web_tree_duplicate/i18n/pt.po new file mode 100644 index 000000000..6a72393d5 --- /dev/null +++ b/web_tree_duplicate/i18n/pt.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-10-28 21:08+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "Duplicar" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "Registos Duplicados" diff --git a/web_tree_duplicate/i18n/pt_BR.po b/web_tree_duplicate/i18n/pt_BR.po new file mode 100644 index 000000000..d354f4579 --- /dev/null +++ b/web_tree_duplicate/i18n/pt_BR.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-15 06:45+0000\n" +"Last-Translator: Marcel Savegnago \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "Duplicado" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "Registros Duplicados" diff --git a/web_tree_duplicate/i18n/web_tree_duplicate.pot b/web_tree_duplicate/i18n/web_tree_duplicate.pot new file mode 100644 index 000000000..8bb4bcf73 --- /dev/null +++ b/web_tree_duplicate/i18n/web_tree_duplicate.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-07-05 08:47+0000\n" +"PO-Revision-Date: 2023-07-05 08:47+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_tree_duplicate +#. odoo-javascript +#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0 +#, python-format +msgid "Duplicate" +msgstr "" + +#. module: web_tree_duplicate +#. odoo-javascript +#: code:addons/web_tree_duplicate/static/src/web_tree_duplicate.esm.js:0 +#, python-format +msgid "Duplicated Records" +msgstr "" diff --git a/web_tree_duplicate/i18n/zh_CN.po b/web_tree_duplicate/i18n/zh_CN.po new file mode 100644 index 000000000..c61592be6 --- /dev/null +++ b/web_tree_duplicate/i18n/zh_CN.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_tree_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-01 12:52+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:47 +#, python-format +msgid "Duplicate" +msgstr "复制" + +#. module: web_tree_duplicate +#. openerp-web +#: code:addons/web_tree_duplicate/static/src/js/backend.js:84 +#, python-format +msgid "Duplicated Records" +msgstr "复制记录" diff --git a/web_tree_duplicate/readme/CONFIGURE.rst b/web_tree_duplicate/readme/CONFIGURE.rst new file mode 100644 index 000000000..6f16d63f0 --- /dev/null +++ b/web_tree_duplicate/readme/CONFIGURE.rst @@ -0,0 +1,20 @@ +The duplicate option is enabled by default. +To disable it you have to add attribute `duplicate` to the tree view. +Set `duplicate` to `false` to enable it or `true` to (explicitly) disable it. + +Example: + +.. code-block:: xml + + + + + res.users + + + + false + + + + diff --git a/web_tree_duplicate/readme/CONTRIBUTORS.rst b/web_tree_duplicate/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..7c909ba59 --- /dev/null +++ b/web_tree_duplicate/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Dennis Sluijk +* Holger Brunn (https://hunki-enterprises.com) diff --git a/web_tree_duplicate/readme/DESCRIPTION.rst b/web_tree_duplicate/readme/DESCRIPTION.rst new file mode 100644 index 000000000..cb705a9dc --- /dev/null +++ b/web_tree_duplicate/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +With this module you can duplicate records directly from the tree view. diff --git a/web_tree_duplicate/readme/USAGE.rst b/web_tree_duplicate/readme/USAGE.rst new file mode 100644 index 000000000..efb9caf74 --- /dev/null +++ b/web_tree_duplicate/readme/USAGE.rst @@ -0,0 +1,9 @@ +To use this module, you need to: + +#. Go to any tree view +#. select some records +#. open the sidebar menu and click 'Duplicate' + +Note that even when selecting all records via the top checkbox on a list, this will only duplicate the currently visible items. If you really need to duplicate all records, you need to adjust the list view limit accordingly. + +.. image:: /web_tree_duplicate/static/description/screenshot-duplicate.png diff --git a/web_tree_duplicate/static/description/icon.png b/web_tree_duplicate/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/web_tree_duplicate/static/description/icon.png differ diff --git a/web_tree_duplicate/static/description/index.html b/web_tree_duplicate/static/description/index.html new file mode 100644 index 000000000..ef0445a4c --- /dev/null +++ b/web_tree_duplicate/static/description/index.html @@ -0,0 +1,458 @@ + + + + + + +Tree View Duplicate Records + + + +
+

Tree View Duplicate Records

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

With this module you can duplicate records directly from the tree view.

+

Table of contents

+ +
+

Configuration

+

The duplicate option is enabled by default. +To disable it you have to add attribute duplicate to the tree view. +Set duplicate to false to enable it or true to (explicitly) disable it.

+

Example:

+
+<?xml version="1.0" encoding="UTF-8" ?>
+<odoo>
+    <record id="view_users_tree" model="ir.ui.view">
+        <field name="model">res.users</field>
+        <field name="inherit_id" ref="base.view_users_tree"/>
+        <field name="arch" type="xml">
+            <xpath expr="//tree" position="attributes">
+                <attribute name="duplicate">false</attribute>
+            </xpath>
+        </field>
+    </record>
+</odoo>
+
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to any tree view;
  2. +
  3. select some records;
  4. +
  5. open the sidebar menu and click ‘Duplicate’.
  6. +
+https://raw.githubusercontent.com/web_tree_duplicate/static/description/screenshot-duplicate.png +
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Hunki Enterprises BV
  • +
  • Onestein
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

tarteo

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_tree_duplicate/static/description/screenshot-duplicate.png b/web_tree_duplicate/static/description/screenshot-duplicate.png new file mode 100644 index 000000000..28fb3ac40 Binary files /dev/null and b/web_tree_duplicate/static/description/screenshot-duplicate.png differ diff --git a/web_tree_duplicate/static/src/web_tree_duplicate.esm.js b/web_tree_duplicate/static/src/web_tree_duplicate.esm.js new file mode 100644 index 000000000..746287097 --- /dev/null +++ b/web_tree_duplicate/static/src/web_tree_duplicate.esm.js @@ -0,0 +1,40 @@ +/** @odoo-module **/ +// (c) 2023 Hunki Enterprises BV () +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +import {Domain} from "@web/core/domain"; +import {ListController} from "@web/views/list/list_controller"; +import {patch} from "@web/core/utils/patch"; + +patch(ListController.prototype, "add duplicate action", { + getActionMenuItems() { + const result = this._super(); + if ( + this.archInfo.activeActions.create && + this.archInfo.activeActions.duplicate + ) { + result.other.push({ + key: "duplicate", + description: this.env._t("Duplicate"), + callback: () => this.duplicateRecords(), + }); + } + return result; + }, + async duplicateRecords() { + const ids = await Promise.all( + this.model.root.selection.map(async (record) => { + return await record.model.orm.call(record.resModel, "copy", [ + record.resId, + ]); + }) + ); + this.env.searchModel.createNewFilters([ + { + description: this.env._t("Duplicated Records"), + domain: new Domain([["id", "in", ids]]).toString(), + type: "filter", + }, + ]); + }, +});