Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/website_sale_order_duplicate/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
88 changes: 88 additions & 0 deletions website_sale_order_duplicate/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/website/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 <https://github.com/OCA/website/issues/new?body=module:%20website_sale_order_duplicate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Contributors
~~~~~~~~~~~~

* `Trey <https://www.trey.es>`__:
* Jorge Camacho <[email protected]>
* Miguel Poyatos <[email protected]>
* Geyson Gualdron <[email protected]>

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 <https://github.com/OCA/website/tree/16.0/website_sale_order_duplicate>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions website_sale_order_duplicate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
###############################################################################
# For copyright and license notices, see __manifest__.py file in root directory
###############################################################################
from . import controllers
20 changes: 20 additions & 0 deletions website_sale_order_duplicate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
],
}
4 changes: 4 additions & 0 deletions website_sale_order_duplicate/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
###############################################################################
# For copyright and license notices, see __manifest__.py file in root directory
###############################################################################
from . import portal
30 changes: 30 additions & 0 deletions website_sale_order_duplicate/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -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/<int:order>"],
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")
23 changes: 23 additions & 0 deletions website_sale_order_duplicate/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>\n"
"Language-Team: Trey <[email protected]>\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"

23 changes: 23 additions & 0 deletions website_sale_order_duplicate/i18n/website_sale_order_duplicate.pot
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>\n"
"Language-Team: Trey <[email protected]>\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 ""

4 changes: 4 additions & 0 deletions website_sale_order_duplicate/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Trey <https://www.trey.es>`__:
* Jorge Camacho <[email protected]>
* Miguel Poyatos <[email protected]>
* Geyson Gualdron <[email protected]>
2 changes: 2 additions & 0 deletions website_sale_order_duplicate/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions website_sale_order_duplicate/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -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.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="portal_my_orders_inherit_duplicate"
name="Portal My Orders Inherit Duplicate"
inherit_id="sale.portal_my_orders"
>
<xpath
expr="//span[@t-field='order.amount_total']/ancestor::td"
position="after"
>
<td>
<a
t-attf-href="/my/order/duplicate/#{order.id}"
class="btn btn-primary btn-sm"
>
Duplicate
</a>
</td>
</xpath>
</template>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="portal_my_quotations_inherit_duplicate"
name="Portal My Quotations Inherit Duplicate"
inherit_id="sale.portal_my_quotations"
>
<xpath
expr="//span[@t-field='quotation.amount_total']/ancestor::td"
position="after"
>
<td>
<a
t-attf-href="/my/order/duplicate/#{quotation.id}"
class="btn btn-primary btn-sm"
>
Duplicate
</a>
</td>
</xpath>
</template>
</odoo>