fix: fix 'empty-docstring' for pylint
This commit is contained in:
		
							parent
							
								
									54602f605d
								
							
						
					
					
						commit
						8d8f276793
					
				
					 11 changed files with 100 additions and 83 deletions
				
			
		| 
						 | 
				
			
			@ -11,4 +11,3 @@ disable=fixme,
 | 
			
		|||
        consider-using-dict-comprehension,
 | 
			
		||||
        consider-using-f-string,
 | 
			
		||||
        consider-using-set-comprehension,
 | 
			
		||||
        empty-docstring,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Sideshow -- Case/Special Order Tracker
 | 
			
		||||
#  Copyright © 2024 Lance Edgar
 | 
			
		||||
#  Copyright © 2024-2025 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Sideshow.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ class SideshowConfig(WuttaConfigExtension):
 | 
			
		|||
 | 
			
		||||
    key = "sideshow"
 | 
			
		||||
 | 
			
		||||
    def configure(self, config):
 | 
			
		||||
    def configure(self, config):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
 | 
			
		||||
        # app info
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -519,7 +519,7 @@ class OrderItem(model.Base):
 | 
			
		|||
    )
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def full_description(self):
 | 
			
		||||
    def full_description(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        fields = [
 | 
			
		||||
            self.product_brand or "",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,7 +169,7 @@ class ProductMixin:
 | 
			
		|||
    )
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def full_description(self):
 | 
			
		||||
    def full_description(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        fields = [self.brand_name or "", self.description or "", self.size or ""]
 | 
			
		||||
        fields = [f.strip() for f in fields if f.strip()]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Sideshow -- Case/Special Order Tracker
 | 
			
		||||
#  Copyright © 2024 Lance Edgar
 | 
			
		||||
#  Copyright © 2024-2025 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Sideshow.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -37,16 +37,16 @@ class OrderRef(ObjectRef):
 | 
			
		|||
    """
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def model_class(self):
 | 
			
		||||
    def model_class(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return model.Order
 | 
			
		||||
 | 
			
		||||
    def sort_query(self, query):
 | 
			
		||||
    def sort_query(self, query):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return query.order_by(self.model_class.order_id)
 | 
			
		||||
 | 
			
		||||
    def get_object_url(self, order):
 | 
			
		||||
    def get_object_url(self, order):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("orders.view", uuid=order.uuid)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -62,16 +62,16 @@ class LocalCustomerRef(ObjectRef):
 | 
			
		|||
    """
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def model_class(self):
 | 
			
		||||
    def model_class(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return model.LocalCustomer
 | 
			
		||||
 | 
			
		||||
    def sort_query(self, query):
 | 
			
		||||
    def sort_query(self, query):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return query.order_by(self.model_class.full_name)
 | 
			
		||||
 | 
			
		||||
    def get_object_url(self, customer):
 | 
			
		||||
    def get_object_url(self, customer):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("local_customers.view", uuid=customer.uuid)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,16 +87,16 @@ class PendingCustomerRef(ObjectRef):
 | 
			
		|||
    """
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def model_class(self):
 | 
			
		||||
    def model_class(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return model.PendingCustomer
 | 
			
		||||
 | 
			
		||||
    def sort_query(self, query):
 | 
			
		||||
    def sort_query(self, query):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return query.order_by(self.model_class.full_name)
 | 
			
		||||
 | 
			
		||||
    def get_object_url(self, customer):
 | 
			
		||||
    def get_object_url(self, customer):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("pending_customers.view", uuid=customer.uuid)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -111,16 +111,16 @@ class LocalProductRef(ObjectRef):
 | 
			
		|||
    """
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def model_class(self):
 | 
			
		||||
    def model_class(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return model.LocalProduct
 | 
			
		||||
 | 
			
		||||
    def sort_query(self, query):
 | 
			
		||||
    def sort_query(self, query):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return query.order_by(self.model_class.scancode)
 | 
			
		||||
 | 
			
		||||
    def get_object_url(self, product):
 | 
			
		||||
    def get_object_url(self, product):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("local_products.view", uuid=product.uuid)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -136,15 +136,15 @@ class PendingProductRef(ObjectRef):
 | 
			
		|||
    """
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def model_class(self):
 | 
			
		||||
    def model_class(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return model.PendingProduct
 | 
			
		||||
 | 
			
		||||
    def sort_query(self, query):
 | 
			
		||||
    def sort_query(self, query):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return query.order_by(self.model_class.scancode)
 | 
			
		||||
 | 
			
		||||
    def get_object_url(self, product):
 | 
			
		||||
    def get_object_url(self, product):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("pending_products.view", uuid=product.uuid)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ class SideshowMenuHandler(base.MenuHandler):
 | 
			
		|||
    Sideshow menu handler
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def make_menus(self, request):
 | 
			
		||||
    def make_menus(self, request):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return [
 | 
			
		||||
            self.make_orders_menu(request),
 | 
			
		||||
| 
						 | 
				
			
			@ -159,7 +159,7 @@ class SideshowMenuHandler(base.MenuHandler):
 | 
			
		|||
            "items": [],
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def make_admin_menu(self, request, **kwargs):
 | 
			
		||||
    def make_admin_menu(self, request, **kwargs):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        kwargs["include_people"] = True
 | 
			
		||||
        menu = super().make_admin_menu(request, **kwargs)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,12 +131,12 @@ class NewOrderBatchView(BatchMasterView):
 | 
			
		|||
        super().__init__(request, context=context)
 | 
			
		||||
        self.order_handler = self.app.get_order_handler()
 | 
			
		||||
 | 
			
		||||
    def get_batch_handler(self):
 | 
			
		||||
    def get_batch_handler(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        # TODO: call self.app.get_batch_handler()
 | 
			
		||||
        return NewOrderBatchHandler(self.config)
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -147,7 +147,7 @@ class NewOrderBatchView(BatchMasterView):
 | 
			
		|||
        # total_price
 | 
			
		||||
        g.set_renderer("total_price", "currency")
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -164,7 +164,7 @@ class NewOrderBatchView(BatchMasterView):
 | 
			
		|||
        # total_price
 | 
			
		||||
        f.set_node("total_price", WuttaMoney(self.request))
 | 
			
		||||
 | 
			
		||||
    def configure_row_grid(self, g):
 | 
			
		||||
    def configure_row_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_row_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ class LocalCustomerView(MasterView):
 | 
			
		|||
        "new_order_batches",
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,7 @@ class LocalCustomerView(MasterView):
 | 
			
		|||
        g.set_link("phone_number")
 | 
			
		||||
        g.set_link("email_address")
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        customer = f.model_instance
 | 
			
		||||
| 
						 | 
				
			
			@ -184,7 +184,7 @@ class LocalCustomerView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return grid
 | 
			
		||||
 | 
			
		||||
    def objectify(self, form):
 | 
			
		||||
    def objectify(self, form):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        customer = super().objectify(form)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -247,7 +247,7 @@ class PendingCustomerView(MasterView):
 | 
			
		|||
        "new_order_batches",
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
| 
						 | 
				
			
			@ -262,7 +262,7 @@ class PendingCustomerView(MasterView):
 | 
			
		|||
        g.set_link("phone_number")
 | 
			
		||||
        g.set_link("email_address")
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
| 
						 | 
				
			
			@ -376,7 +376,7 @@ class PendingCustomerView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return grid
 | 
			
		||||
 | 
			
		||||
    def objectify(self, form):
 | 
			
		||||
    def objectify(self, form):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        customer = super().objectify(form)
 | 
			
		||||
| 
						 | 
				
			
			@ -387,7 +387,7 @@ class PendingCustomerView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return customer
 | 
			
		||||
 | 
			
		||||
    def delete_instance(self, customer):
 | 
			
		||||
    def delete_instance(self, customer):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model_title = self.get_model_title()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
        self.order_handler = self.app.get_order_handler()
 | 
			
		||||
        self.batch_handler = self.app.get_batch_handler("neworder")
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -410,7 +410,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
            session, term, user=self.request.user
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def get_pending_product_required_fields(self):
 | 
			
		||||
    def get_pending_product_required_fields(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        required = []
 | 
			
		||||
        for field in self.PENDING_PRODUCT_ENTRY_FIELDS:
 | 
			
		||||
| 
						 | 
				
			
			@ -534,7 +534,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
        batch.store_id = store_id
 | 
			
		||||
        return self.get_context_customer(batch)
 | 
			
		||||
 | 
			
		||||
    def get_context_customer(self, batch):
 | 
			
		||||
    def get_context_customer(self, batch):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        context = {
 | 
			
		||||
            "store_id": batch.store_id,
 | 
			
		||||
| 
						 | 
				
			
			@ -830,7 +830,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
            "next_url": self.get_action_url("view", order),
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def normalize_batch(self, batch):
 | 
			
		||||
    def normalize_batch(self, batch):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return {
 | 
			
		||||
            "uuid": batch.uuid.hex,
 | 
			
		||||
| 
						 | 
				
			
			@ -840,7 +840,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
            "status_text": batch.status_text,
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    def normalize_row(self, row):
 | 
			
		||||
    def normalize_row(self, row):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        data = {
 | 
			
		||||
            "uuid": row.uuid.hex,
 | 
			
		||||
| 
						 | 
				
			
			@ -954,11 +954,11 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
 | 
			
		||||
        return data
 | 
			
		||||
 | 
			
		||||
    def get_instance_title(self, order):
 | 
			
		||||
    def get_instance_title(self, order):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return f"#{order.order_id} for {order.customer_name}"
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        order = f.model_instance
 | 
			
		||||
| 
						 | 
				
			
			@ -986,7 +986,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
        f.set_node("created_by", UserRef(self.request))
 | 
			
		||||
        f.set_readonly("created_by")
 | 
			
		||||
 | 
			
		||||
    def get_xref_buttons(self, order):
 | 
			
		||||
    def get_xref_buttons(self, order):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        buttons = super().get_xref_buttons(order)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -1008,13 +1008,13 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
 | 
			
		||||
        return buttons
 | 
			
		||||
 | 
			
		||||
    def get_row_grid_data(self, order):
 | 
			
		||||
    def get_row_grid_data(self, order):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        session = self.Session()
 | 
			
		||||
        return session.query(model.OrderItem).filter(model.OrderItem.order == order)
 | 
			
		||||
 | 
			
		||||
    def configure_row_grid(self, g):
 | 
			
		||||
    def configure_row_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_row_grid(g)
 | 
			
		||||
        # enum = self.app.enum
 | 
			
		||||
| 
						 | 
				
			
			@ -1052,23 +1052,27 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
        # TODO: upstream should set this automatically
 | 
			
		||||
        g.row_class = self.row_grid_row_class
 | 
			
		||||
 | 
			
		||||
    def row_grid_row_class(self, item, data, i):  # pylint: disable=unused-argument
 | 
			
		||||
    def row_grid_row_class(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, item, data, i
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        variant = self.order_handler.item_status_to_variant(item.status_code)
 | 
			
		||||
        if variant:
 | 
			
		||||
            return f"has-background-{variant}"
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def render_status_code(self, item, key, value):  # pylint: disable=unused-argument
 | 
			
		||||
    def render_status_code(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, item, key, value
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        return enum.ORDER_ITEM_STATUS[value]
 | 
			
		||||
 | 
			
		||||
    def get_row_action_url_view(self, item, i):
 | 
			
		||||
    def get_row_action_url_view(self, item, i):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        return self.request.route_url("order_items.view", uuid=item.uuid)
 | 
			
		||||
 | 
			
		||||
    def configure_get_simple_settings(self):
 | 
			
		||||
    def configure_get_simple_settings(self):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        settings = [
 | 
			
		||||
            # stores
 | 
			
		||||
| 
						 | 
				
			
			@ -1113,7 +1117,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
 | 
			
		||||
        return settings
 | 
			
		||||
 | 
			
		||||
    def configure_get_context(self, **kwargs):
 | 
			
		||||
    def configure_get_context(self, **kwargs):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        context = super().configure_get_context(**kwargs)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1127,7 +1131,9 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
    def configure_gather_settings(self, data, simple_settings=None):
 | 
			
		||||
    def configure_gather_settings(
 | 
			
		||||
        self, data, simple_settings=None
 | 
			
		||||
    ):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        settings = super().configure_gather_settings(
 | 
			
		||||
            data, simple_settings=simple_settings
 | 
			
		||||
| 
						 | 
				
			
			@ -1150,7 +1156,7 @@ class OrderView(MasterView):  # pylint: disable=too-many-public-methods
 | 
			
		|||
 | 
			
		||||
        return settings
 | 
			
		||||
 | 
			
		||||
    def configure_remove_settings(self, **kwargs):
 | 
			
		||||
    def configure_remove_settings(self, **kwargs):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        session = self.Session()
 | 
			
		||||
| 
						 | 
				
			
			@ -1331,19 +1337,19 @@ class OrderItemView(MasterView):
 | 
			
		|||
        super().__init__(request, context=context)
 | 
			
		||||
        self.order_handler = self.app.get_order_handler()
 | 
			
		||||
 | 
			
		||||
    def get_fallback_templates(self, template):
 | 
			
		||||
    def get_fallback_templates(self, template):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        templates = super().get_fallback_templates(template)
 | 
			
		||||
        templates.insert(0, f"/order-items/{template}.mako")
 | 
			
		||||
        return templates
 | 
			
		||||
 | 
			
		||||
    def get_query(self, session=None):
 | 
			
		||||
    def get_query(self, session=None):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        query = super().get_query(session=session)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        return query.join(model.Order)
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -1393,24 +1399,30 @@ class OrderItemView(MasterView):
 | 
			
		|||
        # status_code
 | 
			
		||||
        g.set_renderer("status_code", self.render_status_code)
 | 
			
		||||
 | 
			
		||||
    def render_order_attr(self, item, key, value):  # pylint: disable=unused-argument
 | 
			
		||||
    def render_order_attr(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, item, key, value
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        order = item.order
 | 
			
		||||
        return getattr(order, key)
 | 
			
		||||
 | 
			
		||||
    def render_status_code(self, item, key, value):  # pylint: disable=unused-argument
 | 
			
		||||
    def render_status_code(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, item, key, value
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        return enum.ORDER_ITEM_STATUS[value]
 | 
			
		||||
 | 
			
		||||
    def grid_row_class(self, item, data, i):  # pylint: disable=unused-argument
 | 
			
		||||
    def grid_row_class(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, item, data, i
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        variant = self.order_handler.item_status_to_variant(item.status_code)
 | 
			
		||||
        if variant:
 | 
			
		||||
            return f"has-background-{variant}"
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
| 
						 | 
				
			
			@ -1458,7 +1470,7 @@ class OrderItemView(MasterView):
 | 
			
		|||
        # paid_amount
 | 
			
		||||
        f.set_node("paid_amount", WuttaMoney(self.request))
 | 
			
		||||
 | 
			
		||||
    def get_template_context(self, context):
 | 
			
		||||
    def get_template_context(self, context):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        if self.viewing:
 | 
			
		||||
            model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -1508,7 +1520,9 @@ class OrderItemView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
    def render_event_note(self, event, key, value):  # pylint: disable=unused-argument
 | 
			
		||||
    def render_event_note(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, event, key, value
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        if event.type_code == enum.ORDER_ITEM_EVENT_NOTE_ADDED:
 | 
			
		||||
| 
						 | 
				
			
			@ -1520,7 +1534,7 @@ class OrderItemView(MasterView):
 | 
			
		|||
            )
 | 
			
		||||
        return value
 | 
			
		||||
 | 
			
		||||
    def get_xref_buttons(self, item):
 | 
			
		||||
    def get_xref_buttons(self, item):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        buttons = super().get_xref_buttons(item)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1645,7 +1659,7 @@ class OrderItemView(MasterView):
 | 
			
		|||
        return items
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def defaults(cls, config):
 | 
			
		||||
    def defaults(cls, config):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        cls._order_item_defaults(config)
 | 
			
		||||
        cls._defaults(config)
 | 
			
		||||
| 
						 | 
				
			
			@ -1745,14 +1759,14 @@ class PlacementView(OrderItemView):
 | 
			
		|||
        "vendor_name": {"active": True},
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def get_query(self, session=None):
 | 
			
		||||
    def get_query(self, session=None):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        query = super().get_query(session=session)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        return query.filter(model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_READY)
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1883,7 +1897,7 @@ class ReceivingView(OrderItemView):
 | 
			
		|||
        "vendor_name": {"active": True},
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def get_query(self, session=None):
 | 
			
		||||
    def get_query(self, session=None):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        query = super().get_query(session=session)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -1892,7 +1906,7 @@ class ReceivingView(OrderItemView):
 | 
			
		|||
            model.OrderItem.status_code == enum.ORDER_ITEM_STATUS_PLACED
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2064,7 +2078,7 @@ class ContactView(OrderItemView):
 | 
			
		|||
    route_prefix = "order_items_contact"
 | 
			
		||||
    url_prefix = "/contact"
 | 
			
		||||
 | 
			
		||||
    def get_query(self, session=None):
 | 
			
		||||
    def get_query(self, session=None):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        query = super().get_query(session=session)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -2075,7 +2089,7 @@ class ContactView(OrderItemView):
 | 
			
		|||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2231,7 +2245,7 @@ class DeliveryView(OrderItemView):
 | 
			
		|||
    route_prefix = "order_items_delivery"
 | 
			
		||||
    url_prefix = "/delivery"
 | 
			
		||||
 | 
			
		||||
    def get_query(self, session=None):
 | 
			
		||||
    def get_query(self, session=None):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        query = super().get_query(session=session)
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
| 
						 | 
				
			
			@ -2242,7 +2256,7 @@ class DeliveryView(OrderItemView):
 | 
			
		|||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,7 +88,7 @@ class LocalProductView(MasterView):
 | 
			
		|||
        "new_order_batches",
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ class LocalProductView(MasterView):
 | 
			
		|||
        g.set_link("description")
 | 
			
		||||
        g.set_link("size")
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        product = f.model_instance
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +293,7 @@ class PendingProductView(MasterView):
 | 
			
		|||
        "new_order_batches",
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
| 
						 | 
				
			
			@ -314,14 +314,16 @@ class PendingProductView(MasterView):
 | 
			
		|||
        g.set_link("description")
 | 
			
		||||
        g.set_link("size")
 | 
			
		||||
 | 
			
		||||
    def grid_row_class(self, product, data, i):  # pylint: disable=unused-argument
 | 
			
		||||
    def grid_row_class(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, product, data, i
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
        if product.status == enum.PendingProductStatus.IGNORED:
 | 
			
		||||
            return "has-background-warning"
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
        product = f.model_instance
 | 
			
		||||
| 
						 | 
				
			
			@ -441,7 +443,7 @@ class PendingProductView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return grid
 | 
			
		||||
 | 
			
		||||
    def get_template_context(self, context):
 | 
			
		||||
    def get_template_context(self, context):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        enum = self.app.enum
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -455,7 +457,7 @@ class PendingProductView(MasterView):
 | 
			
		|||
 | 
			
		||||
        return context
 | 
			
		||||
 | 
			
		||||
    def delete_instance(self, product):
 | 
			
		||||
    def delete_instance(self, product):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
 | 
			
		||||
        # avoid deleting if still referenced by new order batch(es)
 | 
			
		||||
| 
						 | 
				
			
			@ -534,7 +536,7 @@ class PendingProductView(MasterView):
 | 
			
		|||
        return self.redirect(self.get_action_url("view", product))
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def defaults(cls, config):
 | 
			
		||||
    def defaults(cls, config):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        cls._defaults(config)
 | 
			
		||||
        cls._pending_product_defaults(config)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ class StoreView(MasterView):
 | 
			
		|||
 | 
			
		||||
    sort_defaults = "store_id"
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
    def configure_grid(self, g):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_grid(g)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,13 +64,15 @@ class StoreView(MasterView):
 | 
			
		|||
        g.set_link("store_id")
 | 
			
		||||
        g.set_link("name")
 | 
			
		||||
 | 
			
		||||
    def grid_row_class(self, store, data, i):  # pylint: disable=unused-argument
 | 
			
		||||
    def grid_row_class(  # pylint: disable=unused-argument,empty-docstring
 | 
			
		||||
        self, store, data, i
 | 
			
		||||
    ):
 | 
			
		||||
        """ """
 | 
			
		||||
        if store.archived:
 | 
			
		||||
            return "has-background-warning"
 | 
			
		||||
        return None
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
    def configure_form(self, f):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        super().configure_form(f)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +82,7 @@ class StoreView(MasterView):
 | 
			
		|||
        # name
 | 
			
		||||
        f.set_validator("name", self.unique_name)
 | 
			
		||||
 | 
			
		||||
    def unique_store_id(self, node, value):
 | 
			
		||||
    def unique_store_id(self, node, value):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        session = self.Session()
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +96,7 @@ class StoreView(MasterView):
 | 
			
		|||
        if query.count():
 | 
			
		||||
            node.raise_invalid("Store ID must be unique")
 | 
			
		||||
 | 
			
		||||
    def unique_name(self, node, value):
 | 
			
		||||
    def unique_name(self, node, value):  # pylint: disable=empty-docstring
 | 
			
		||||
        """ """
 | 
			
		||||
        model = self.app.model
 | 
			
		||||
        session = self.Session()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue