diff --git a/setup/website_sale_order_duplicate/odoo/addons/website_sale_order_duplicate b/setup/website_sale_order_duplicate/odoo/addons/website_sale_order_duplicate new file mode 120000 index 0000000000..23a768cbed --- /dev/null +++ b/setup/website_sale_order_duplicate/odoo/addons/website_sale_order_duplicate @@ -0,0 +1 @@ +../../../../website_sale_order_duplicate \ No newline at end of file diff --git a/setup/website_sale_order_duplicate/setup.py b/setup/website_sale_order_duplicate/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_sale_order_duplicate/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_sale_order_duplicate/README.rst b/website_sale_order_duplicate/README.rst new file mode 100644 index 0000000000..1c5ef7a5f9 --- /dev/null +++ b/website_sale_order_duplicate/README.rst @@ -0,0 +1,88 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +============================ +Website Sale Order Duplicate +============================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:386da15809a16005afe1959768a629886ebc86568d1bd0854e47dc7f1369cce1 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-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%2Fwebsite-lightgray.png?logo=github + :target: https://github.com/OCA/website/tree/16.0/website_sale_order_duplicate + :alt: OCA/website +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/website-16-0/website-16-0-website_sale_order_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/website&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to duplicate a sales order or quote from the portal and sets it as +the store's current cart. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module you need to: + +#. From the “quotes” or “sales orders” sections of the “My Account” section, + you can duplicate records using the “duplicate” button located in the view. + + +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 +======= + +Contributors +~~~~~~~~~~~~ + +* `Trey `__: + * Jorge Camacho + * Miguel Poyatos + * Geyson Gualdron + +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. + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_order_duplicate/__init__.py b/website_sale_order_duplicate/__init__.py new file mode 100644 index 0000000000..4bc0aa4b7a --- /dev/null +++ b/website_sale_order_duplicate/__init__.py @@ -0,0 +1,4 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from . import controllers diff --git a/website_sale_order_duplicate/__manifest__.py b/website_sale_order_duplicate/__manifest__.py new file mode 100644 index 0000000000..c013a4afb4 --- /dev/null +++ b/website_sale_order_duplicate/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Trey +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Website Sale Order Duplicate", + "summary": "Duplicate order and set it as current cart", + "category": "Website", + "version": "16.0.1.0.0", + "author": "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/website", + "license": "AGPL-3", + "depends": [ + "portal", + "sale", + "website_sale", + ], + "data": [ + "views/portal_my_orders_inherit_views.xml", + "views/portal_my_quotations_inherit_views.xml", + ], +} diff --git a/website_sale_order_duplicate/controllers/__init__.py b/website_sale_order_duplicate/controllers/__init__.py new file mode 100644 index 0000000000..9d8b29c5cb --- /dev/null +++ b/website_sale_order_duplicate/controllers/__init__.py @@ -0,0 +1,4 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from . import portal diff --git a/website_sale_order_duplicate/controllers/portal.py b/website_sale_order_duplicate/controllers/portal.py new file mode 100644 index 0000000000..c9493f4fa7 --- /dev/null +++ b/website_sale_order_duplicate/controllers/portal.py @@ -0,0 +1,30 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from odoo import http +from odoo.exceptions import AccessError +from odoo.http import request + +try: + from odoo.addons.sale.controllers.portal import CustomerPortal +except ImportError: + CustomerPortal = object + + +class CustomerPortal(CustomerPortal): + @http.route( + ["/my/order/duplicate/"], + type="http", + auth="user", + website=True, + ) + def portal_order_duplicate(self, order, access_token=None): + try: + order_sudo = self._document_check_access( + "sale.order", order, access_token=access_token + ) + except AccessError: + return request.redirect("/my") + order_copy = order_sudo.copy() + request.session["sale_order_id"] = order_copy.id + return request.redirect("/shop/cart") diff --git a/website_sale_order_duplicate/i18n/es.po b/website_sale_order_duplicate/i18n/es.po new file mode 100644 index 0000000000..4c14055084 --- /dev/null +++ b/website_sale_order_duplicate/i18n/es.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_order_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Trey \n" +"Language-Team: Trey \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: website_sale_order_duplicate +#: model_terms:ir.ui.view,arch_db:website_sale_order_duplicate.portal_my_orders +#: model_terms:ir.ui.view,arch_db:website_sale_order_duplicate.portal_my_quotations +msgid "Duplicate" +msgstr "Duplicar" + diff --git a/website_sale_order_duplicate/i18n/website_sale_order_duplicate.pot b/website_sale_order_duplicate/i18n/website_sale_order_duplicate.pot new file mode 100644 index 0000000000..4bf49d9e29 --- /dev/null +++ b/website_sale_order_duplicate/i18n/website_sale_order_duplicate.pot @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_order_duplicate +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Trey \n" +"Language-Team: Trey \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: website_sale_order_duplicate +#: model_terms:ir.ui.view,arch_db:website_sale_order_duplicate.portal_my_orders +#: model_terms:ir.ui.view,arch_db:website_sale_order_duplicate.portal_my_quotations +msgid "Duplicate" +msgstr "" + diff --git a/website_sale_order_duplicate/readme/CONTRIBUTORS.rst b/website_sale_order_duplicate/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..8e41eb356c --- /dev/null +++ b/website_sale_order_duplicate/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Trey `__: + * Jorge Camacho + * Miguel Poyatos + * Geyson Gualdron diff --git a/website_sale_order_duplicate/readme/DESCRIPTION.rst b/website_sale_order_duplicate/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..05d70b784b --- /dev/null +++ b/website_sale_order_duplicate/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to duplicate a sales order or quote from the portal and sets it as +the store's current cart. diff --git a/website_sale_order_duplicate/readme/USAGE.rst b/website_sale_order_duplicate/readme/USAGE.rst new file mode 100644 index 0000000000..865c9cdcd4 --- /dev/null +++ b/website_sale_order_duplicate/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module you need to: + +#. From the “quotes” or “sales orders” sections of the “My Account” section, + you can duplicate records using the “duplicate” button located in the view. + diff --git a/website_sale_order_duplicate/static/description/icon.png b/website_sale_order_duplicate/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/website_sale_order_duplicate/static/description/icon.png differ diff --git a/website_sale_order_duplicate/views/portal_my_orders_inherit_views.xml b/website_sale_order_duplicate/views/portal_my_orders_inherit_views.xml new file mode 100644 index 0000000000..a090b8a158 --- /dev/null +++ b/website_sale_order_duplicate/views/portal_my_orders_inherit_views.xml @@ -0,0 +1,22 @@ + + + + diff --git a/website_sale_order_duplicate/views/portal_my_quotations_inherit_views.xml b/website_sale_order_duplicate/views/portal_my_quotations_inherit_views.xml new file mode 100644 index 0000000000..986db7ec0e --- /dev/null +++ b/website_sale_order_duplicate/views/portal_my_quotations_inherit_views.xml @@ -0,0 +1,22 @@ + + + +