diff --git a/stock_archive_constraint/README.rst b/stock_archive_constraint/README.rst index c5ac3635e..d7278630e 100644 --- a/stock_archive_constraint/README.rst +++ b/stock_archive_constraint/README.rst @@ -42,7 +42,9 @@ Usage 1. Go to Settings > Users > Edit a user and check the "Manage Multiple Stock Locations" permission -2. Go to Inventory > Settings > Locations and disable one +2. Go to Inventory > Settings > Locations and archive one +3. Go to inventory > Products > Products and try to archive one product + associated to stock picking Bug Tracker =========== diff --git a/stock_archive_constraint/__manifest__.py b/stock_archive_constraint/__manifest__.py index 748084902..e787f23d5 100644 --- a/stock_archive_constraint/__manifest__.py +++ b/stock_archive_constraint/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Stock archive constraint", - "version": "15.0.1.0.2", + "version": "17.0.1.0.0", "license": "AGPL-3", "website": "https://github.com/OCA/stock-logistics-warehouse", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/stock_archive_constraint/models/product_product.py b/stock_archive_constraint/models/product_product.py index 49a488674..2e33b2457 100644 --- a/stock_archive_constraint/models/product_product.py +++ b/stock_archive_constraint/models/product_product.py @@ -29,7 +29,8 @@ class ProductProduct(models.Model): if res: raise ValidationError( _( - "It is not possible to archive product '%(display_name)s' which has " + "It is not possible to archive product " + "'%(display_name)s' which has " "associated stock quantities." ) % {"display_name": res.product_id.display_name} @@ -49,7 +50,8 @@ class ProductProduct(models.Model): if res: raise ValidationError( _( - "It is not possible to archive product '%(display_name)s' which has " + "It is not possible to archive product " + "'%(display_name)s' which has " "associated picking lines." ) % {"display_name": res.product_id.display_name} @@ -69,7 +71,8 @@ class ProductProduct(models.Model): if res: raise ValidationError( _( - "It is not possible to archive product '%(display_name)s' which has " + "It is not possible to archive product " + "'%(display_name)s' which has " "associated stock reservations." ) % {"display_name": res.product_id.display_name} diff --git a/stock_archive_constraint/models/product_template.py b/stock_archive_constraint/models/product_template.py deleted file mode 100644 index d6813c9f4..000000000 --- a/stock_archive_constraint/models/product_template.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2020 Tecnativa - Víctor Martínez -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import api, models - - -class ProductTemplate(models.Model): - _inherit = "product.template" - - @api.constrains("active") - def _check_active_stock_archive_constraint(self): - self.product_variant_ids._check_active_stock_archive_constraint() diff --git a/stock_archive_constraint/models/stock_location.py b/stock_archive_constraint/models/stock_location.py index 04ae12afe..996c900ce 100644 --- a/stock_archive_constraint/models/stock_location.py +++ b/stock_archive_constraint/models/stock_location.py @@ -31,7 +31,8 @@ class StockLocation(models.Model): if res: raise ValidationError( _( - "It is not possible to archive location '%(display_name)s' which has " + "It is not possible to archive location " + "'%(display_name)s' which has " "associated stock quantities." ) % {"display_name": res.display_name} @@ -54,7 +55,8 @@ class StockLocation(models.Model): if res: raise ValidationError( _( - "It is not possible to archive location '%(display_name)s' which has " + "It is not possible to archive location " + "'%(display_name)s' which has " "associated picking lines." ) % {"display_name": res.display_name} @@ -77,7 +79,8 @@ class StockLocation(models.Model): if res: raise ValidationError( _( - "It is not possible to archive location '%(display_name)s' which has " + "It is not possible to archive location " + "'%(display_name)s' which has " "associated stock reservations." ) % {"display_name": res.display_name} diff --git a/stock_archive_constraint/readme/USAGE.md b/stock_archive_constraint/readme/USAGE.md index b7ad3ecb8..19c317593 100644 --- a/stock_archive_constraint/readme/USAGE.md +++ b/stock_archive_constraint/readme/USAGE.md @@ -1,3 +1,4 @@ 1. Go to Settings \> Users \> Edit a user and check the "Manage Multiple Stock Locations" permission -2. Go to Inventory \> Settings \> Locations and disable one +2. Go to Inventory \> Settings \> Locations and archive one +3. Go to inventory \> Products \> Products and try to archive one product associated to stock picking diff --git a/stock_archive_constraint/static/description/index.html b/stock_archive_constraint/static/description/index.html index f9a40a6d9..7485a1f44 100644 --- a/stock_archive_constraint/static/description/index.html +++ b/stock_archive_constraint/static/description/index.html @@ -391,7 +391,9 @@ stock.quant or stock.move.