diff --git a/stock_inventory_lockdown/README.rst b/stock_inventory_lockdown/README.rst index cd4a593be..b94142e3b 100644 --- a/stock_inventory_lockdown/README.rst +++ b/stock_inventory_lockdown/README.rst @@ -14,13 +14,13 @@ Inventory Lock Down :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_inventory_lockdown + :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_inventory_lockdown :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_inventory_lockdown + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_inventory_lockdown :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/12.0 + :target: https://runbot.odoo-community.org/runbot/153/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -40,7 +40,7 @@ can be recorded in/out of the inventory's location: users will get an error message. Creating or modifying locations is also forbidden. -.. image:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/12.0/stock_inventory_lockdown/stock_inventory_lockdown/static/images/move_error.png +.. figure:: https://raw.githubusercontent.com/OCA/stock-logistics-warehouse/13.0/stock_inventory_lockdown/static/images/move_error.png :alt: Error message Bug Tracker @@ -49,7 +49,7 @@ 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 smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -60,7 +60,7 @@ Authors ~~~~~~~ * Numérigraphe -* Eficent +* ForgeFlow Contributors ~~~~~~~~~~~~ @@ -69,8 +69,8 @@ Contributors * Lionel Sausin (Numérigraphe) * Laetitia Gangloff (Acsone) * Laurent Mignon (Acsone) -* Lois Rilo (Eficent) -* Jordi Ballester (Eficent) +* Lois Rilo (ForgeFlow) +* Jordi Ballester (ForgeFlow) * Michael Allen * Bhavesh Odedra @@ -87,6 +87,6 @@ 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/stock-logistics-warehouse `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_inventory_lockdown/__manifest__.py b/stock_inventory_lockdown/__manifest__.py index ca056cc29..98c9f71da 100644 --- a/stock_inventory_lockdown/__manifest__.py +++ b/stock_inventory_lockdown/__manifest__.py @@ -4,10 +4,10 @@ { "name": "Inventory Lock Down", "summary": "Lock down stock locations during inventories.", - "version": "12.0.1.0.1", + "version": "13.0.1.0.0", "development_status": "Mature", "depends": ["stock"], - "author": "Numérigraphe, Eficent, Odoo Community Association (OCA)", + "author": "Numérigraphe, ForgeFlow, Odoo Community Association (OCA)", "website": "https://github.com/OCA/stock-logistics-warehouse", "category": "Warehouse Management", "images": ["images/move_error.png", "images/location_locked.png"], diff --git a/stock_inventory_lockdown/models/stock_inventory.py b/stock_inventory_lockdown/models/stock_inventory.py index 32743f76d..b09051707 100644 --- a/stock_inventory_lockdown/models/stock_inventory.py +++ b/stock_inventory_lockdown/models/stock_inventory.py @@ -1,5 +1,5 @@ # © 2013-2016 Numérigraphe SARL -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2017 ForgeFlow S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -14,15 +14,17 @@ class StockInventory(models.Model): """IDs of locations in open exhaustive inventories, with children""" inventory_domain = [("state", "=", "confirm")] if locations_ids: - inventory_domain.append(("location_id", "child_of", locations_ids)) + inventory_domain.append(("location_ids", "child_of", locations_ids)) inventories = self.search(inventory_domain) if not inventories: # Early exit if no match found return [] - location_ids = inventories.mapped("location_id") + location_ids = inventories.mapped("location_ids") # Extend to the children Locations location_domain = [ + "|", + ("location_id", "in", location_ids.ids), ("location_id", "child_of", location_ids.ids), ("usage", "in", ["internal", "transit"]), ] diff --git a/stock_inventory_lockdown/models/stock_location.py b/stock_inventory_lockdown/models/stock_location.py index 559b56011..cdb7b2c1d 100644 --- a/stock_inventory_lockdown/models/stock_location.py +++ b/stock_inventory_lockdown/models/stock_location.py @@ -11,7 +11,6 @@ class StockLocation(models.Model): _inherit = "stock.location" _order = "name" - @api.multi @api.constrains("location_id") def _check_inventory_location_id(self): """Error if an inventory is being conducted here""" @@ -22,7 +21,6 @@ class StockLocation(models.Model): if location_inventory_open_ids: raise ValidationError(_("An inventory is being conducted at this location")) - @api.multi def unlink(self): """Refuse unlink if an inventory is being conducted""" location_inventory_open_ids = ( diff --git a/stock_inventory_lockdown/models/stock_move.py b/stock_inventory_lockdown/models/stock_move.py index 8e0f36ca4..21c34dd49 100644 --- a/stock_inventory_lockdown/models/stock_move.py +++ b/stock_inventory_lockdown/models/stock_move.py @@ -1,5 +1,5 @@ # © 2016 Numérigraphe SARL -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2017 ForgeFlow S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). @@ -10,12 +10,10 @@ from odoo.exceptions import ValidationError class StockMove(models.Model): _inherit = "stock.move" - @api.multi def _get_reserved_locations(self): self.ensure_one() return self.move_line_ids.mapped("location_id") - @api.multi def _get_dest_locations(self): self.ensure_one() return self.move_line_ids.mapped("location_dest_id") @@ -48,7 +46,7 @@ class StockMove(models.Model): raise ValidationError( _( "An inventory is being conducted at the following " - "location(s):\n%s" + "location(s):\n - %s" ) % "\n - ".join(location_names) ) diff --git a/stock_inventory_lockdown/readme/CONTRIBUTORS.rst b/stock_inventory_lockdown/readme/CONTRIBUTORS.rst index f8d04adcf..8da38e274 100644 --- a/stock_inventory_lockdown/readme/CONTRIBUTORS.rst +++ b/stock_inventory_lockdown/readme/CONTRIBUTORS.rst @@ -2,7 +2,7 @@ * Lionel Sausin (Numérigraphe) * Laetitia Gangloff (Acsone) * Laurent Mignon (Acsone) -* Lois Rilo (Eficent) -* Jordi Ballester (Eficent) +* Lois Rilo (ForgeFlow) +* Jordi Ballester (ForgeFlow) * Michael Allen * Bhavesh Odedra diff --git a/stock_inventory_lockdown/readme/USAGE.rst b/stock_inventory_lockdown/readme/USAGE.rst index 81f302c86..c567fb339 100644 --- a/stock_inventory_lockdown/readme/USAGE.rst +++ b/stock_inventory_lockdown/readme/USAGE.rst @@ -3,5 +3,5 @@ can be recorded in/out of the inventory's location: users will get an error message. Creating or modifying locations is also forbidden. -.. image:: stock_inventory_lockdown/static/images/move_error.png +.. figure:: static/images/move_error.png :alt: Error message diff --git a/stock_inventory_lockdown/static/description/index.html b/stock_inventory_lockdown/static/description/index.html index 81b1f340f..8377ca53d 100644 --- a/stock_inventory_lockdown/static/description/index.html +++ b/stock_inventory_lockdown/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Mature License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Mature License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

This module lets you lock down the locations during an inventory.

Table of contents

@@ -388,14 +388,16 @@ ul.auto-toc { can be recorded in/out of the inventory’s location: users will get an error message. Creating or modifying locations is also forbidden.

-Error message +
+Error message +

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 smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -404,7 +406,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

Authors

  • Numérigraphe
  • -
  • Eficent
  • +
  • ForgeFlow
@@ -414,8 +416,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
  • Laetitia Gangloff (Acsone) <laetitia.gangloff@acsone.eu>
  • Laurent Mignon (Acsone) <laurent.mignon@acsone.eu>
  • -
  • Lois Rilo (Eficent) <lois.rilo@eficent.com>
  • -
  • Jordi Ballester (Eficent) <jordi.ballester@eficent.com>
  • +
  • Lois Rilo (ForgeFlow) <lois.rilo@forgeflow.com>
  • +
  • Jordi Ballester (ForgeFlow) <jordi.ballester@forgeflow.com>
  • Michael Allen <mallen@opensourceintegrators.com>
  • Bhavesh Odedra <bodedra@opensourceintegrators.com>
  • @@ -427,7 +429,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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/stock-logistics-warehouse project on GitHub.

    +

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/stock_inventory_lockdown/tests/test_stock_inventory_lockdown.py b/stock_inventory_lockdown/tests/test_stock_inventory_lockdown.py index 56c6e7f9f..47fe86579 100644 --- a/stock_inventory_lockdown/tests/test_stock_inventory_lockdown.py +++ b/stock_inventory_lockdown/tests/test_stock_inventory_lockdown.py @@ -45,11 +45,7 @@ class StockInventoryLocationTest(TestStockCommon): ) # Prepare an inventory self.inventory = self.env["stock.inventory"].create( - { - "name": "Lock down location", - "filter": "none", - "location_id": self.new_location.id, - } + {"name": "Lock down location", "location_ids": [(4, self.new_location.id)]} ) self.inventory.action_start() self.assertTrue(self.inventory.line_ids, "The inventory is empty.") @@ -69,13 +65,15 @@ class StockInventoryLocationTest(TestStockCommon): def test_update_parent_location(self): """Updating the parent of a location is OK if no inv. in progress.""" self.inventory.action_cancel_draft() - self.inventory.location_id.location_id = self.env.ref("stock.stock_location_4") + self.inventory.location_ids.location_id = self.env.ref( + "stock.stock_location_14" + ) def test_update_parent_location_locked_down(self): """Updating the parent of a location must fail""" with self.assertRaises(ValidationError): - self.inventory.location_id.location_id = self.env.ref( - "stock.stock_location_4" + self.inventory.location_ids.location_id = self.env.ref( + "stock.stock_location_stock" ) def test_inventory(self): @@ -103,8 +101,7 @@ class StockInventoryLocationTest(TestStockCommon): inventory_subloc = self.env["stock.inventory"].create( { "name": "Lock down location", - "filter": "partial", - "location_id": self.new_sublocation.id, + "location_ids": [(4, self.new_sublocation.id)], } ) inventory_subloc.action_start() @@ -127,7 +124,7 @@ class StockInventoryLocationTest(TestStockCommon): """Stock moves must be forbidden during inventory from/to inventoried location.""" move1 = self.create_stock_move( - self.productA, origin_id=self.inventory.location_id.id + self.productA, origin_id=self.inventory.location_ids.id ) move1._action_confirm() with self.assertRaises(ValidationError): @@ -135,7 +132,7 @@ class StockInventoryLocationTest(TestStockCommon): move1.move_line_ids[0].qty_done = 10.0 move1._action_done() move2 = self.create_stock_move( - self.productA, dest_id=self.inventory.location_id.id + self.productA, dest_id=self.inventory.location_ids.id ) with self.assertRaises(ValidationError): move2._action_confirm()