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
96 changes: 96 additions & 0 deletions sale_order_restrict_copy_archived_product/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=========================================
Sale Order Restrict Copy Archived Product
=========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0a45899235ca42095f841584b3ea4d2ca751c1ec7028410a1e5c6487d3077871
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_order_restrict_copy_archived_product
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_order_restrict_copy_archived_product
: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/sale-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to restrict duplication of sales order if they
have archived products.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

1. Go to Sales / Orders
2. Select a Sale with archived products, or archive a product of a sale.
3. Click to the Action -> Duplicate button of the Sale Order form. A
validation error message will be displayed showing the archived
products.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_order_restrict_copy_archived_product%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
=======

Authors
-------

* Sygel

Contributors
------------

- `Sygel <https://www.sygel.es>`__:

- Alberto Martínez
- Valentin Vinagre
- Harald Panten

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_order_restrict_copy_archived_product/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
16 changes: 16 additions & 0 deletions sale_order_restrict_copy_archived_product/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Order Restrict Copy Archived Product",
"summary": "Restrict dulpication of sales order if they have archived products",
"version": "16.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/sale-workflow",
"author": "Sygel, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale",
],
}
28 changes: 28 additions & 0 deletions sale_order_restrict_copy_archived_product/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_restrict_copy_archived_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-09-25 09:41+0000\n"
"Last-Translator: Alberto Martínez <alberto.martinez@sygel.es>\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 5.10.4\n"

#. module: sale_order_restrict_copy_archived_product
#: model:ir.model,name:sale_order_restrict_copy_archived_product.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"

#. module: sale_order_restrict_copy_archived_product
#: code:addons/sale_order_restrict_copy_archived_product/models/sale_order.py:0
#, python-format
msgid "You can't duplicate sale orders with archived products: {}"
msgstr "No puedes duplicar pedidos de venta con productos archivados: {}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_order_restrict_copy_archived_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \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: sale_order_restrict_copy_archived_product
#: model:ir.model,name:sale_order_restrict_copy_archived_product.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_order_restrict_copy_archived_product
#: code:addons/sale_order_restrict_copy_archived_product/models/sale_order.py:0
#, python-format
msgid "You can't duplicate sale orders with archived products: {}"
msgstr ""
3 changes: 3 additions & 0 deletions sale_order_restrict_copy_archived_product/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import sale_order
21 changes: 21 additions & 0 deletions sale_order_restrict_copy_archived_product/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, exceptions, models


class SaleOrder(models.Model):
_inherit = "sale.order"

def copy(self, default=None):
archived_products = self.mapped("order_line.product_id").filtered(
lambda p: not p.active
)
if archived_products:
raise exceptions.ValidationError(
_(
"You can't duplicate sale orders with archived products: %(product_names)s",
product_names=", ".join(archived_products.mapped("name")),
)
)
return super().copy(default)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Sygel](https://www.sygel.es):
- Alberto Martínez
- Valentin Vinagre
- Harald Panten
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows you to restrict duplication of sales order if they have archived products.
5 changes: 5 additions & 0 deletions sale_order_restrict_copy_archived_product/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To use this module, you need to:

1. Go to Sales / Orders
2. Select a Sale with archived products, or archive a product of a sale.
3. Click to the Action -> Duplicate button of the Sale Order form. A validation error message will be displayed showing the archived products.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading