Feat: Product Variations page get, filter, and save. \n Fix: Active column changed to Add / Delete / Undelete column - this change has only been applied to Product Variations page
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -99,6 +99,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
FLAG_NAME: ClassVar[str] = Base.FLAG_NAME
|
||||
FLAG_NAME_ATTR_OPTION_TEXT: ClassVar[str] = Base.FLAG_NAME_ATTR_OPTION_TEXT
|
||||
FLAG_NAME_ATTR_OPTION_VALUE: ClassVar[str] = Base.FLAG_NAME_ATTR_OPTION_VALUE
|
||||
FLAG_NAME_PLURAL: ClassVar[str] = Base.FLAG_NAME_PLURAL
|
||||
FLAG_NAV_ADMIN_HOME: ClassVar[str] = 'navAdminHome'
|
||||
FLAG_NAV_ADMIN_STORE_STRIPE_PRICES: ClassVar[str] = 'navAdminStoreStripePrices'
|
||||
FLAG_NAV_ADMIN_STORE_STRIPE_PRODUCTS: ClassVar[str] = 'navAdminStoreStripeProducts'
|
||||
|
||||
@@ -23,7 +23,7 @@ from business_objects.store.product import Product, Parameters_Product, Product_
|
||||
from business_objects.store.image import Resolution_Level_Enum
|
||||
from business_objects.store.basket import Basket_Item, Basket
|
||||
from business_objects.store.product_category import Product_Category
|
||||
from business_objects.store.product_variation import Product_Variation_Filters, Product_Variation
|
||||
from business_objects.store.product_variation import Product_Variation, Parameters_Product_Variation
|
||||
from business_objects.store.stock_item import Stock_Item
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
@@ -148,6 +148,7 @@ class Model_View_Store(Model_View_Base):
|
||||
HASH_GET_STORE_PRODUCT: ClassVar[str] = '/store/product_get'
|
||||
HASH_GET_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/category_get'
|
||||
HASH_GET_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/permutation_get'
|
||||
HASH_GET_STORE_PRODUCT_VARIATION: ClassVar[str] = '/store/product_variation_get'
|
||||
HASH_GET_STORE_STOCK_ITEM: ClassVar[str] = '/store/stock_item_get'
|
||||
HASH_GET_STORE_SUPPLIER: ClassVar[str] = '/store/supplier_get'
|
||||
HASH_GET_STORE_SUPPLIER_PURCHASE_ORDER: ClassVar[str] = '/store/supplier_purchase_order_get'
|
||||
@@ -157,6 +158,7 @@ class Model_View_Store(Model_View_Base):
|
||||
HASH_SAVE_STORE_PRODUCT: ClassVar[str] = '/store/save_product'
|
||||
HASH_SAVE_STORE_PRODUCT_CATEGORY: ClassVar[str] = '/store/save_category'
|
||||
HASH_SAVE_STORE_PRODUCT_PERMUTATION: ClassVar[str] = '/store/save_permutation'
|
||||
HASH_SAVE_STORE_PRODUCT_VARIATION: ClassVar[str] = '/store/save_product_variation'
|
||||
HASH_SAVE_STORE_STOCK_ITEM: ClassVar[str] = '/store/save_stock_item'
|
||||
HASH_SAVE_STORE_SUPPLIER: ClassVar[str] = '/store/save_supplier'
|
||||
HASH_SAVE_STORE_SUPPLIER_PURCHASE_ORDER: ClassVar[str] = '/store/save_supplier_purchase_order'
|
||||
@@ -502,6 +504,6 @@ class Model_View_Store(Model_View_Base):
|
||||
|
||||
def get_many_product_variation(self, variation_filters = None):
|
||||
if variation_filters is None:
|
||||
variation_filters = Product_Variation_Filters.get_default()
|
||||
variation_filters = Parameters_Product_Variation.get_default()
|
||||
variation_types, variations, errors = DataStore_Store_Base().get_many_product_variation(variation_filters)
|
||||
return variation_types, variations, errors
|
||||
@@ -79,7 +79,6 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
# product_blank: Product = None
|
||||
units_measurement: list = None
|
||||
units_measurement_time: list = None
|
||||
# variation_container: Product_Variation_Container = None
|
||||
variations: list = None
|
||||
variation_types: list = None
|
||||
|
||||
|
||||
@@ -14,13 +14,12 @@ Data model for store permutations view
|
||||
from models.model_view_store import Model_View_Store
|
||||
# from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from datastores.datastore_store_product_category import DataStore_Store_Product_Category
|
||||
from business_objects.store.product import Parameters_Product
|
||||
from business_objects.store.product_category import Product_Category_Container # , Filters_Product_Category
|
||||
from forms.access_level import Filters_Access_Level
|
||||
# from forms.store.product_permutation import Filters_Product_Permutation
|
||||
from forms.store.product_category import Filters_Product_Category
|
||||
# from routes import bp_home
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.product_variation import Product_Variation_Container
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from forms.store.product_permutation import Filters_Product_Permutation
|
||||
# from routes import bp_home
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.product_variation import Product_Variation_Container
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
@@ -35,7 +34,6 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
list_options_product: list = None
|
||||
units_measurement: list = None
|
||||
units_measurement_time: list = None
|
||||
# variation_container: Product_Variation_Container = None
|
||||
variations: list = None
|
||||
variation_types: list = None
|
||||
|
||||
|
||||
54
models/model_view_store_product_variation.py
Normal file
54
models/model_view_store_product_variation.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
Project: PARTS Website
|
||||
Author: Edward Middleton-Smith
|
||||
Precision And Research Technology Systems Limited
|
||||
|
||||
Technology: View Models
|
||||
Feature: Store Product View Model
|
||||
|
||||
Description:
|
||||
Data model for store product view
|
||||
"""
|
||||
|
||||
# IMPORTS
|
||||
# VARIABLE INSTANTIATION
|
||||
# METHODS
|
||||
|
||||
# IMPORTS
|
||||
# internal
|
||||
from business_objects.store.product_variation import Product_Variation, Parameters_Product_Variation
|
||||
from business_objects.store.product_category import Product_Category_Container
|
||||
from datastores.datastore_store_product_variation import DataStore_Store_Product_Variation
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.store.product_variation import Filters_Product_Variation
|
||||
from helpers.helper_app import Helper_App
|
||||
from models.model_view_store import Model_View_Store
|
||||
# from routes import bp_home
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from typing import ClassVar
|
||||
|
||||
|
||||
class Model_View_Store_Product_Variation(Model_View_Store):
|
||||
form_filters: Filters_Product_Variation = None
|
||||
form_filters_old: Filters_Product_Variation
|
||||
variation_types: list = None
|
||||
variations: list = None
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return 'Store Product Variation'
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCT_VARIATIONS):
|
||||
_m = 'Model_View_Store_Product_Variation.__init__'
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current = hash_page_current, form_filters_old = form_filters_old)
|
||||
self.form_filters = form_filters_old
|
||||
parameters_variation = Parameters_Product_Variation.from_filters_product_variation(self.form_filters)
|
||||
datastore_variation = DataStore_Store_Product_Variation()
|
||||
self.variation_types, self.variations, errors = datastore_variation.get_many_product_variation(parameters_variation)
|
||||
|
||||
@classmethod
|
||||
def save_product_variations(cls, comment, list_orders):
|
||||
_m = f'{cls.__name__}.save_product_variations'
|
||||
return DataStore_Store_Product_Variation().save_product_variations(comment, list_orders)
|
||||
Reference in New Issue
Block a user