From 4fbed3c27f7f41c195469e9ab795b93dcf37c2da Mon Sep 17 00:00:00 2001 From: Valentin Vinagre Urteaga Date: Fri, 29 Oct 2021 17:36:17 +0200 Subject: [PATCH] [MIG]stock_picking_auto_create_lot: Migration to 14.0 --- .../odoo/addons/stock_picking_auto_create_lot | 1 + setup/stock_picking_auto_create_lot/setup.py | 6 ++++++ stock_picking_auto_create_lot/README.rst | 10 +++++----- stock_picking_auto_create_lot/__manifest__.py | 2 +- .../models/stock_move_line.py | 6 +++--- stock_picking_auto_create_lot/models/stock_picking.py | 6 +++--- stock_picking_auto_create_lot/readme/CONTRIBUTORS.rst | 1 + .../tests/test_stock_picking_auto_create_lot.py | 10 +++++----- 8 files changed, 25 insertions(+), 17 deletions(-) create mode 120000 setup/stock_picking_auto_create_lot/odoo/addons/stock_picking_auto_create_lot create mode 100644 setup/stock_picking_auto_create_lot/setup.py diff --git a/setup/stock_picking_auto_create_lot/odoo/addons/stock_picking_auto_create_lot b/setup/stock_picking_auto_create_lot/odoo/addons/stock_picking_auto_create_lot new file mode 120000 index 00000000000..c5d000aee32 --- /dev/null +++ b/setup/stock_picking_auto_create_lot/odoo/addons/stock_picking_auto_create_lot @@ -0,0 +1 @@ +../../../../stock_picking_auto_create_lot \ No newline at end of file diff --git a/setup/stock_picking_auto_create_lot/setup.py b/setup/stock_picking_auto_create_lot/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/stock_picking_auto_create_lot/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_auto_create_lot/README.rst b/stock_picking_auto_create_lot/README.rst index c020b975595..a2a6cd27bae 100644 --- a/stock_picking_auto_create_lot/README.rst +++ b/stock_picking_auto_create_lot/README.rst @@ -14,13 +14,13 @@ Stock Picking Auto Create Lot :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--workflow-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_auto_create_lot + :target: https://github.com/OCA/stock-logistics-workflow/tree/14.0/stock_picking_auto_create_lot :alt: OCA/stock-logistics-workflow .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-stock_picking_auto_create_lot + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-14-0/stock-logistics-workflow-14-0-stock_picking_auto_create_lot :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/154/13.0 + :target: https://runbot.odoo-community.org/runbot/154/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -61,7 +61,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. @@ -103,6 +103,6 @@ Current `maintainer `__: |maintainer-sergio-teruel| -This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_auto_create_lot/__manifest__.py b/stock_picking_auto_create_lot/__manifest__.py index 3b2f1af53bc..f4786c4af63 100644 --- a/stock_picking_auto_create_lot/__manifest__.py +++ b/stock_picking_auto_create_lot/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Picking Auto Create Lot", "summary": "Auto create lots for incoming pickings", - "version": "13.0.1.1.0", + "version": "14.0.1.0.0", "development_status": "Production/Stable", "category": "stock", "website": "https://github.com/OCA/stock-logistics-workflow", diff --git a/stock_picking_auto_create_lot/models/stock_move_line.py b/stock_picking_auto_create_lot/models/stock_move_line.py index 3f90e722297..439b1fdf495 100644 --- a/stock_picking_auto_create_lot/models/stock_move_line.py +++ b/stock_picking_auto_create_lot/models/stock_move_line.py @@ -17,9 +17,9 @@ def _prepare_auto_lot_values(self): def set_lot_auto(self): """ - Create lots using create_multi to avoid too much queries - As move lines were created by product or by tracked 'serial' - products, we apply the lot with both different approaches. + Create lots using create_multi to avoid too much queries + As move lines were created by product or by tracked 'serial' + products, we apply the lot with both different approaches. """ values = [] production_lot_obj = self.env["stock.production.lot"] diff --git a/stock_picking_auto_create_lot/models/stock_picking.py b/stock_picking_auto_create_lot/models/stock_picking.py index 332ad0e715f..b9ab0b8bb04 100644 --- a/stock_picking_auto_create_lot/models/stock_picking.py +++ b/stock_picking_auto_create_lot/models/stock_picking.py @@ -9,7 +9,7 @@ class StockPicking(models.Model): def _set_auto_lot(self): """ - Allows to be called either by button or through code + Allows to be called either by button or through code """ pickings = self.filtered(lambda p: p.picking_type_id.auto_create_lot) lines = pickings.mapped("move_line_ids").filtered( @@ -22,9 +22,9 @@ def _set_auto_lot(self): ) lines.set_lot_auto() - def action_done(self): + def _action_done(self): self._set_auto_lot() - return super().action_done() + return super()._action_done() def button_validate(self): self._set_auto_lot() diff --git a/stock_picking_auto_create_lot/readme/CONTRIBUTORS.rst b/stock_picking_auto_create_lot/readme/CONTRIBUTORS.rst index 359f6510e9a..d88be9e79c2 100644 --- a/stock_picking_auto_create_lot/readme/CONTRIBUTORS.rst +++ b/stock_picking_auto_create_lot/readme/CONTRIBUTORS.rst @@ -2,3 +2,4 @@ * Sergio Teruel * Pimolnat Suntian * Denis Roussel +* Valentin Vinagre diff --git a/stock_picking_auto_create_lot/tests/test_stock_picking_auto_create_lot.py b/stock_picking_auto_create_lot/tests/test_stock_picking_auto_create_lot.py index 715fab384de..ddda3c368f9 100644 --- a/stock_picking_auto_create_lot/tests/test_stock_picking_auto_create_lot.py +++ b/stock_picking_auto_create_lot/tests/test_stock_picking_auto_create_lot.py @@ -63,7 +63,7 @@ def test_auto_create_lot(self): ) self.assertTrue(move.display_assign_serial) - self.picking.action_done() + self.picking._action_done() lot = self.env["stock.production.lot"].search( [("product_id", "=", self.product.id)] ) @@ -121,9 +121,9 @@ def test_auto_create_transfer_lot(self): def test_multi_auto_create_lot(self): """ - Create two pickings - Try to validate them together - Check if lots have been assigned to each move + Create two pickings + Try to validate them together + Check if lots have been assigned to each move """ self.picking.action_assign() picking_1 = self.picking @@ -139,7 +139,7 @@ def test_multi_auto_create_lot(self): for line in moves.mapped("move_line_ids"): self.assertFalse(line.lot_id) - pickings.action_done() + pickings._action_done() for line in moves.mapped("move_line_ids"): self.assertTrue(line.lot_id)