From 646f9423e0e947734d8a3adb4e5109884c94d350 Mon Sep 17 00:00:00 2001 From: Reed Hayashikawa Date: Tue, 6 Jul 2021 16:40:25 -0700 Subject: [PATCH] [IMP] stock_putaway_method: black, isort, prettier --- .../odoo/addons/stock_putaway_method | 1 + setup/stock_putaway_method/setup.py | 6 ++++ stock_putaway_method/__manifest__.py | 30 ++++++++----------- .../models/product_strategy.py | 10 +++---- .../tests/test_putaway_method.py | 4 +-- .../views/product_strategy_views.xml | 8 +++-- 6 files changed, 31 insertions(+), 28 deletions(-) create mode 120000 setup/stock_putaway_method/odoo/addons/stock_putaway_method create mode 100644 setup/stock_putaway_method/setup.py diff --git a/setup/stock_putaway_method/odoo/addons/stock_putaway_method b/setup/stock_putaway_method/odoo/addons/stock_putaway_method new file mode 120000 index 000000000..f265e5e26 --- /dev/null +++ b/setup/stock_putaway_method/odoo/addons/stock_putaway_method @@ -0,0 +1 @@ +../../../../stock_putaway_method \ No newline at end of file diff --git a/setup/stock_putaway_method/setup.py b/setup/stock_putaway_method/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_putaway_method/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_putaway_method/__manifest__.py b/stock_putaway_method/__manifest__.py index 5554a3a7f..1857b163b 100644 --- a/stock_putaway_method/__manifest__.py +++ b/stock_putaway_method/__manifest__.py @@ -1,21 +1,15 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Putaway strategy method', - 'summary': 'Add the putaway strategy method back, ' - 'removed from the stock module in Odoo 12', - 'version': '12.0.1.0.0', - 'category': 'Inventory', - 'website': 'https://github.com/OCA/stock-logistics-warehouse', - 'author': 'Camptocamp SA, ' - 'Odoo Community Association (OCA)', - 'license': 'AGPL-3', - 'depends': [ - 'product', - 'stock' - ], - 'data': [ - 'views/product_strategy_views.xml' - ], - 'development_status': 'Production/Stable', - 'maintainers': ['asaunier'], + "name": "Putaway strategy method", + "summary": "Add the putaway strategy method back, " + "removed from the stock module in Odoo 12", + "version": "12.0.1.0.0", + "category": "Inventory", + "website": "https://github.com/OCA/stock-logistics-warehouse", + "author": "Camptocamp SA, " "Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["product", "stock"], + "data": ["views/product_strategy_views.xml"], + "development_status": "Production/Stable", + "maintainers": ["asaunier"], } diff --git a/stock_putaway_method/models/product_strategy.py b/stock_putaway_method/models/product_strategy.py index c16b179fe..faee83fea 100644 --- a/stock_putaway_method/models/product_strategy.py +++ b/stock_putaway_method/models/product_strategy.py @@ -3,15 +3,15 @@ from odoo import api, fields, models class PutAwayStrategy(models.Model): - _inherit = 'product.putaway' + _inherit = "product.putaway" method = fields.Selection( - selection='_get_putaway_options', - string='Method', - default='fixed', + selection="_get_putaway_options", + string="Method", + default="fixed", required=True, ) @api.model def _get_putaway_options(self): - return [('fixed', 'Fixed Location')] + return [("fixed", "Fixed Location")] diff --git a/stock_putaway_method/tests/test_putaway_method.py b/stock_putaway_method/tests/test_putaway_method.py index 75f85762b..adef92567 100644 --- a/stock_putaway_method/tests/test_putaway_method.py +++ b/stock_putaway_method/tests/test_putaway_method.py @@ -8,5 +8,5 @@ class TestPutawayMethod(TransactionCase): # Check if "fixed" is a valid putaway method def test_01_putaway_methods(self): - field_method = self.env['product.putaway']._fields.get('method') - self.assertIn('fixed', field_method.get_values(self.env)) + field_method = self.env["product.putaway"]._fields.get("method") + self.assertIn("fixed", field_method.get_values(self.env)) diff --git a/stock_putaway_method/views/product_strategy_views.xml b/stock_putaway_method/views/product_strategy_views.xml index e4edfbd43..b85afa0ab 100644 --- a/stock_putaway_method/views/product_strategy_views.xml +++ b/stock_putaway_method/views/product_strategy_views.xml @@ -3,13 +3,15 @@ product.putaway.form.method product.putaway - + - + - {'invisible': [('method', '!=', 'fixed')]} + {'invisible': [('method', '!=', 'fixed')]}