[IMP] stock_orderpoint_generator: black, isort, prettier

This commit is contained in:
sergiocorato
2023-10-20 12:29:46 +02:00
parent a5592019f4
commit 19d9086b4d
6 changed files with 19 additions and 11 deletions

View File

@@ -0,0 +1 @@
../../../../stock_orderpoint_generator

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -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)

View File

@@ -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

View File

@@ -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):

View File

@@ -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
"""