From 19d9086b4d85e5b4d182c5a5c3349091a5c0df9e Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Fri, 20 Oct 2023 12:29:46 +0200 Subject: [PATCH] [IMP] stock_orderpoint_generator: black, isort, prettier --- .../odoo/addons/stock_orderpoint_generator | 1 + setup/stock_orderpoint_generator/setup.py | 6 ++++++ .../models/orderpoint_template.py | 14 +++++++------- stock_orderpoint_generator/models/product.py | 4 ++-- .../tests/test_orderpoint_generator.py | 3 ++- .../wizard/orderpoint_generator.py | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) create mode 120000 setup/stock_orderpoint_generator/odoo/addons/stock_orderpoint_generator create mode 100644 setup/stock_orderpoint_generator/setup.py diff --git a/setup/stock_orderpoint_generator/odoo/addons/stock_orderpoint_generator b/setup/stock_orderpoint_generator/odoo/addons/stock_orderpoint_generator new file mode 120000 index 000000000..280f25ec6 --- /dev/null +++ b/setup/stock_orderpoint_generator/odoo/addons/stock_orderpoint_generator @@ -0,0 +1 @@ +../../../../stock_orderpoint_generator \ No newline at end of file diff --git a/setup/stock_orderpoint_generator/setup.py b/setup/stock_orderpoint_generator/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/stock_orderpoint_generator/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_orderpoint_generator/models/orderpoint_template.py b/stock_orderpoint_generator/models/orderpoint_template.py index 893f1a542..cc0f0d753 100644 --- a/stock_orderpoint_generator/models/orderpoint_template.py +++ b/stock_orderpoint_generator/models/orderpoint_template.py @@ -10,7 +10,7 @@ from odoo import api, fields, models class OrderpointTemplate(models.Model): - """ Template for orderpoints + """Template for orderpoints Here we use same model as stock.warehouse.orderpoint but set product_id as non mandatory as we cannot remove it. This field will be ignored. @@ -83,7 +83,7 @@ class OrderpointTemplate(models.Model): def _template_fields_to_discard(self): """In order to create every orderpoint we should pop this template - customization fields """ + customization fields""" return [ "auto_generate", "auto_product_ids", @@ -120,9 +120,9 @@ class OrderpointTemplate(models.Model): self, products, location_id, from_date, to_date, criteria ): """Returns a dict with product ids as keys and the resulting - calculation of historic moves according to criteria. If the - creteria is delivered we just search how many items were - delivered in the given period of time""" + calculation of historic moves according to criteria. If the + creteria is delivered we just search how many items were + delivered in the given period of time""" if criteria == "delivered": return products._get_delivered_to_customer_dict( location_id, from_date, to_date @@ -138,7 +138,7 @@ class OrderpointTemplate(models.Model): def _create_instances(self, product_ids): """Create instances of model using template inherited model and - compute autovalues if needed""" + compute autovalues if needed""" orderpoint_model = self.env["stock.warehouse.orderpoint"] for record in self: # Flag equality so we compute the values just once @@ -181,7 +181,7 @@ class OrderpointTemplate(models.Model): orderpoint_model.create(vals_list) def create_orderpoints(self, products): - """ Create orderpoint for *products* based on these templates. + """Create orderpoint for *products* based on these templates. :type products: recordset of products """ self._disable_old_instances(products) diff --git a/stock_orderpoint_generator/models/product.py b/stock_orderpoint_generator/models/product.py index f76ea12e5..981654a0b 100644 --- a/stock_orderpoint_generator/models/product.py +++ b/stock_orderpoint_generator/models/product.py @@ -127,8 +127,8 @@ class ProductProduct(models.Model): self, location_id=False, from_date=False, to_date=False ): """Returns a dict of products with a dict of historic moves as for - a list of historic stock values resulting from those moves. If - a location_id is passed, we can restrict it to such location""" + a list of historic stock values resulting from those moves. If + a location_id is passed, we can restrict it to such location""" location = location_id and location_id.id domain_quant_loc, domain_move_in_loc, domain_move_out_loc = self.with_context( location=location diff --git a/stock_orderpoint_generator/tests/test_orderpoint_generator.py b/stock_orderpoint_generator/tests/test_orderpoint_generator.py index 672ab6c2c..463105af6 100644 --- a/stock_orderpoint_generator/tests/test_orderpoint_generator.py +++ b/stock_orderpoint_generator/tests/test_orderpoint_generator.py @@ -285,7 +285,8 @@ class TestOrderpointGenerator(SavepointCase): def wizard_over_products(self, product, template): return self.wizard_model.with_context( - active_model=product._name, active_ids=product.ids, + active_model=product._name, + active_ids=product.ids, ).create({"orderpoint_template_id": [(6, 0, template.ids)]}) def test_product_orderpoint(self): diff --git a/stock_orderpoint_generator/wizard/orderpoint_generator.py b/stock_orderpoint_generator/wizard/orderpoint_generator.py index a72a39f03..d9327040d 100644 --- a/stock_orderpoint_generator/wizard/orderpoint_generator.py +++ b/stock_orderpoint_generator/wizard/orderpoint_generator.py @@ -9,7 +9,7 @@ _template_register = ["orderpoint_template_id"] class OrderpointGenerator(models.TransientModel): - """ Wizard defining stock.warehouse.orderpoint configurations for selected + """Wizard defining stock.warehouse.orderpoint configurations for selected products. Those configs are generated using templates """