Skip to content

Commit d33bc52

Browse files
committed
Merge PR #4158 into 18.0
Signed-off-by HaraldPanten
2 parents c197689 + c4af6ef commit d33bc52

File tree

16 files changed

+780
-0
lines changed

16 files changed

+780
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
=========================================
2+
Sale Order Restrict Copy Archived Product
3+
=========================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:0a45899235ca42095f841584b3ea4d2ca751c1ec7028410a1e5c6487d3077871
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_restrict_copy_archived_product
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_restrict_copy_archived_product
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows you to restrict duplication of sales order if they
32+
have archived products.
33+
34+
**Table of contents**
35+
36+
.. contents::
37+
:local:
38+
39+
Usage
40+
=====
41+
42+
To use this module, you need to:
43+
44+
1. Go to Sales / Orders
45+
2. Select a Sale with archived products, or archive a product of a sale.
46+
3. Click to the Action -> Duplicate button of the Sale Order form. A
47+
validation error message will be displayed showing the archived
48+
products.
49+
50+
Bug Tracker
51+
===========
52+
53+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
54+
In case of trouble, please check there if your issue has already been reported.
55+
If you spotted it first, help us to smash it by providing a detailed and welcomed
56+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_restrict_copy_archived_product%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
57+
58+
Do not contact contributors directly about support or help with technical issues.
59+
60+
Credits
61+
=======
62+
63+
Authors
64+
-------
65+
66+
* Sygel
67+
68+
Contributors
69+
------------
70+
71+
- `Sygel <https://www.sygel.es>`__:
72+
73+
- Alberto Martínez
74+
- Valentin Vinagre
75+
- Harald Panten
76+
77+
Maintainers
78+
-----------
79+
80+
This module is maintained by the OCA.
81+
82+
.. image:: https://odoo-community.org/logo.png
83+
:alt: Odoo Community Association
84+
:target: https://odoo-community.org
85+
86+
OCA, or the Odoo Community Association, is a nonprofit organization whose
87+
mission is to support the collaborative development of Odoo features and
88+
promote its widespread use.
89+
90+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_restrict_copy_archived_product>`_ project on GitHub.
91+
92+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Sale Order Restrict Copy Archived Product",
5+
"summary": "Restrict dulpication of sales order if they have archived products",
6+
"version": "18.0.1.0.0",
7+
"category": "Sales",
8+
"website": "https://github.com/OCA/sale-workflow",
9+
"author": "Sygel, Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"application": False,
12+
"installable": True,
13+
"depends": [
14+
"sale",
15+
],
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_restrict_copy_archived_product
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2025-09-25 09:41+0000\n"
10+
"Last-Translator: Alberto Martínez <alberto.martinez@sygel.es>\n"
11+
"Language-Team: none\n"
12+
"Language: es\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 5.10.4\n"
18+
19+
#. module: sale_order_restrict_copy_archived_product
20+
#: model:ir.model,name:sale_order_restrict_copy_archived_product.model_sale_order
21+
msgid "Sales Order"
22+
msgstr "Pedido de venta"
23+
24+
#. module: sale_order_restrict_copy_archived_product
25+
#: code:addons/sale_order_restrict_copy_archived_product/models/sale_order.py:0
26+
#, python-format
27+
msgid "You can't duplicate sale orders with archived products: {}"
28+
msgstr "No puedes duplicar pedidos de venta con productos archivados: {}"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_restrict_copy_archived_product
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_order_restrict_copy_archived_product
17+
#: model:ir.model,name:sale_order_restrict_copy_archived_product.model_sale_order
18+
msgid "Sales Order"
19+
msgstr ""
20+
21+
#. module: sale_order_restrict_copy_archived_product
22+
#: code:addons/sale_order_restrict_copy_archived_product/models/sale_order.py:0
23+
#, python-format
24+
msgid "You can't duplicate sale orders with archived products: {}"
25+
msgstr ""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
3+
from . import sale_order
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2025 Alberto Martínez <alberto.martinez@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import _, exceptions, models
5+
6+
7+
class SaleOrder(models.Model):
8+
_inherit = "sale.order"
9+
10+
def copy(self, default=None):
11+
for order in self:
12+
archived_products = order.order_line.mapped("product_id").filtered(
13+
lambda p: not p.active
14+
)
15+
if archived_products:
16+
raise exceptions.ValidationError(
17+
_("You can't duplicate sale orders with archived products: %s")
18+
% ", ".join(archived_products.mapped("name"))
19+
)
20+
return super().copy(default)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- [Sygel](https://www.sygel.es):
2+
- Alberto Martínez
3+
- Valentin Vinagre
4+
- Harald Panten
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows you to restrict duplication of sales order if they have archived products.

0 commit comments

Comments
 (0)