diff --git a/setup/stock_generate_putaway_from_inventory/odoo/addons/stock_generate_putaway_from_inventory b/setup/stock_generate_putaway_from_inventory/odoo/addons/stock_generate_putaway_from_inventory new file mode 120000 index 000000000..f4ad37be2 --- /dev/null +++ b/setup/stock_generate_putaway_from_inventory/odoo/addons/stock_generate_putaway_from_inventory @@ -0,0 +1 @@ +../../../../stock_generate_putaway_from_inventory \ No newline at end of file diff --git a/setup/stock_generate_putaway_from_inventory/setup.py b/setup/stock_generate_putaway_from_inventory/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_generate_putaway_from_inventory/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_generate_putaway_from_inventory/models/stock_inventory.py b/stock_generate_putaway_from_inventory/models/stock_inventory.py index 75e238fc2..965081024 100644 --- a/stock_generate_putaway_from_inventory/models/stock_inventory.py +++ b/stock_generate_putaway_from_inventory/models/stock_inventory.py @@ -1,7 +1,7 @@ # © 2018 Akretion # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, _ +from odoo import _, models from odoo.exceptions import ValidationError @@ -27,9 +27,7 @@ class StockInventory(models.Model): ] ) if putaway_line: - putaway_line.write( - {"fixed_location_id": inventory_line.location_id.id} - ) + putaway_line.write({"fixed_location_id": inventory_line.location_id.id}) else: putaway_line_obj.create( { diff --git a/stock_generate_putaway_from_inventory/readme/CONTRIBUTORS.rst b/stock_generate_putaway_from_inventory/readme/CONTRIBUTORS.rst index 536128cd3..d88f06775 100644 --- a/stock_generate_putaway_from_inventory/readme/CONTRIBUTORS.rst +++ b/stock_generate_putaway_from_inventory/readme/CONTRIBUTORS.rst @@ -1,4 +1,4 @@ * Pierrick Brun * David Beal * Sébastien Beau -* Kevin Khao \ No newline at end of file +* Kevin Khao diff --git a/stock_generate_putaway_from_inventory/readme/DESCRIPTION.rst b/stock_generate_putaway_from_inventory/readme/DESCRIPTION.rst index 85d8d2855..86cd21ff7 100644 --- a/stock_generate_putaway_from_inventory/readme/DESCRIPTION.rst +++ b/stock_generate_putaway_from_inventory/readme/DESCRIPTION.rst @@ -1 +1 @@ -Synchronize a Product Putaway Location from an inventory. Note that this module assumes that there is a one-to-one correspondence between the location and putaway strategy, and if the location currently has no putaway strategy, an error will be raised. \ No newline at end of file +Synchronize a Product Putaway Location from an inventory. Note that this module assumes that there is a one-to-one correspondence between the location and putaway strategy, and if the location currently has no putaway strategy, an error will be raised. diff --git a/stock_generate_putaway_from_inventory/tests/test_generate_putaway.py b/stock_generate_putaway_from_inventory/tests/test_generate_putaway.py index d4ec05f3f..bc392f96f 100644 --- a/stock_generate_putaway_from_inventory/tests/test_generate_putaway.py +++ b/stock_generate_putaway_from_inventory/tests/test_generate_putaway.py @@ -1,8 +1,8 @@ # Copyright Akretion # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo.tests.common import TransactionCase from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase class TestGeneratePutaway(TransactionCase): @@ -28,27 +28,21 @@ class TestGeneratePutaway(TransactionCase): self.irrelevant_location = ref("stock.stock_location_customers") def test_error_not_validated(self): - putaway = self.env["product.putaway"].create( - {"name": "Putaway example"} - ) + putaway = self.env["product.putaway"].create({"name": "Putaway example"}) self.inventory.putaway_strategy_id = putaway self.inventory.action_cancel_draft() with self.assertRaises(ValidationError): self.inventory.action_generate_putaway_strategy() def test_error_location_has_no_putaway_strategy(self): - self.inventory_location.putaway_strategy_id = self.env[ - "product.putaway" - ] + self.inventory_location.putaway_strategy_id = self.env["product.putaway"] self.inventory.action_start() self.inventory.action_validate() with self.assertRaises(ValidationError): self.inventory.action_generate_putaway_strategy() def test_putaway_line_location_update(self): - putaway = self.env["product.putaway"].create( - {"name": "Putaway example"} - ) + putaway = self.env["product.putaway"].create({"name": "Putaway example"}) putaway_line_1 = self.env["stock.fixed.putaway.strat"].create( { "putaway_id": putaway.id, @@ -65,9 +59,7 @@ class TestGeneratePutaway(TransactionCase): ) def test_putaway_line_location_create(self): - putaway = self.env["product.putaway"].create( - {"name": "Putaway example"} - ) + putaway = self.env["product.putaway"].create({"name": "Putaway example"}) self.inventory_location.putaway_strategy_id = putaway self.inventory.action_start() self.inventory.action_validate() @@ -75,6 +67,4 @@ class TestGeneratePutaway(TransactionCase): putaway_line = putaway.product_location_ids.filtered( lambda r: r.product_id == self.inventory_line_1_product ) - self.assertEqual( - putaway_line.fixed_location_id, self.inventory_line_1_location - ) + self.assertEqual(putaway_line.fixed_location_id, self.inventory_line_1_location) diff --git a/stock_generate_putaway_from_inventory/views/stock_inventory.xml b/stock_generate_putaway_from_inventory/views/stock_inventory.xml index ed4fc6510..d2497fc75 100644 --- a/stock_generate_putaway_from_inventory/views/stock_inventory.xml +++ b/stock_generate_putaway_from_inventory/views/stock_inventory.xml @@ -1,10 +1,10 @@ - + Generate putaway strategies - - + + code records.action_generate_putaway_strategy()