1. Logout callback fix.\n 2. Store permutations report improvement for demo.

This commit is contained in:
2024-08-07 09:01:33 +01:00
parent 545c328b0b
commit 18977c8cac
2096 changed files with 381570 additions and 388 deletions

View File

@@ -38,6 +38,7 @@ class Model_View_Base(BaseModel, ABC):
ATTR_VALUE_CURRENT: ClassVar[str] = 'current-value'
ATTR_VALUE_PREVIOUS: ClassVar[str] = 'previous-value'
FLAG_ACTIVE: ClassVar[str] = 'active'
FLAG_ADD: ClassVar[str] = 'add'
FLAG_BUTTON_CANCEL: ClassVar[str] = 'button-cancel'
FLAG_BUTTON_MODAL_CLOSE: ClassVar[str] = 'button-overlay-close'
FLAG_BUTTON_SUBMIT: ClassVar[str] = 'button-submit'
@@ -47,6 +48,8 @@ class Model_View_Base(BaseModel, ABC):
FLAG_COLUMN: ClassVar[str] = 'column'
FLAG_CONTAINER: ClassVar[str] = 'container'
FLAG_CONTAINER_INPUT: ClassVar[str] = FLAG_CONTAINER + '-input'
FLAG_DELETE: ClassVar[str] = 'delete'
FLAG_DETAIL: ClassVar[str] = 'detail'
FLAG_DIRTY: ClassVar[str] = 'dirty'
FLAG_ERROR: ClassVar[str] = 'error'
FLAG_EXPANDED: ClassVar[str] = 'expanded'

View File

@@ -25,6 +25,7 @@ from datastores.datastore_store import DataStore_Store
from forms import Form_Basket_Edit, Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
from business_objects.basket import Basket_Item, Basket
from business_objects.category import Category
from business_objects.variation import Variation_Filters, Variation
# external
from flask import send_file, jsonify
from flask_sqlalchemy import SQLAlchemy
@@ -42,7 +43,8 @@ class Model_View_Store(Model_View_Base):
# ATTR_ID_PRODUCT_CATEGORY : ClassVar[str] = 'id-product-category'
ATTR_ID_PRODUCT : ClassVar[str] = Product.ATTR_ID_PRODUCT # 'id-product'
ATTR_ID_PERMUTATION : ClassVar[str] = Product.ATTR_ID_PERMUTATION # 'id-permutation'
FLAG_BASKET_ITEM_DELETE : ClassVar[str] = 'basket-item-delete'
ATTR_ID_VARIATION : ClassVar[str] = Variation.ATTR_ID_VARIATION # 'id-variation'
ATTR_ID_VARIATION_TYPE : ClassVar[str] = Variation.ATTR_ID_VARIATION_TYPE # 'id-variation-type'
FLAG_BUTTON_BASKET_ADD : ClassVar[str] = Model_View_Base.FLAG_BUTTON_SUBMIT + '.buttonAdd2Basket'
FLAG_BUTTON_BUY_NOW : ClassVar[str] = 'buttonBuyNow'
FLAG_CATEGORY: ClassVar[str] = 'category'
@@ -91,6 +93,8 @@ class Model_View_Store(Model_View_Base):
KEY_ID_REGION_DELIVERY : ClassVar[str] = Basket.KEY_ID_REGION_DELIVERY # 'id_region_delivery'
KEY_IS_INCLUDED_VAT : ClassVar[str] = Basket.KEY_IS_INCLUDED_VAT # 'is_included_VAT'
KEY_ITEMS : ClassVar[str] = Basket.KEY_ITEMS # 'items'
KEY_NAME_VARIATION : ClassVar[str] = Variation.KEY_NAME_VARIATION
KEY_NAME_VARIATION_TYPE : ClassVar[str] = Variation.KEY_NAME_VARIATION_TYPE
KEY_PRICE : ClassVar[str] = 'price'
KEY_QUANTITY : ClassVar[str] = 'quantity'
KEY_VALUE_DEFAULT : ClassVar[str] = 'default'
@@ -391,4 +395,10 @@ class Model_View_Store(Model_View_Base):
def get_regions_and_currencies(self):
regions, currencies = DataStore_Store(self.db, self.info_user, self.app).get_regions_and_currencies()
return regions, currencies
return regions, currencies
def get_many_product_variation(self, variation_filters = None):
if variation_filters is None:
variation_filters = Variation_Filters.get_default()
variations, errors = DataStore_Store(self.app, self.db).get_many_product_variation(variation_filters)
return variations, errors

View File

@@ -17,6 +17,7 @@ from business_objects.category import Category_List
from forms import Form_Filters_Permutation
# from routes import bp_home
from business_objects.product import Product, Product_Filters, Product_Permutation
from business_objects.variation import Variation_List
import lib.argument_validation as av
# external
@@ -36,10 +37,11 @@ class Model_View_Store_Permutation(Model_View_Store):
filters_product: Product_Filters
form_filters: Form_Filters_Permutation = None
permutation_blank: Product_Permutation = None
variations: Variation_List = None
@property
def title(self):
return 'Store Permutations'
return 'Stock Report'
def __init__(self, app, db, filters_product, **kwargs):
_m = 'Model_View_Store_Permutation.__init__'
@@ -70,6 +72,8 @@ class Model_View_Store_Permutation(Model_View_Store):
self.form_filters.id_product.choices = [('0', 'All')] + [(str(product['value']), product['text']) for product in product_list]
self.permutation_blank = Product_Permutation()
print(f'category options: {self.form_filters.id_category.choices}')
variations, errors = self.get_many_product_variation()
self.variations = variations
def save_permutations(self, comment, list_permutations):
_m = 'Model_View_Store_Permutation.save_permutations'