Fix: Console outputs suppressed when not in debug mode to fix server errors caused by unnecessary outputs.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,6 +11,7 @@ Data model for store permutations view
|
||||
"""
|
||||
|
||||
# internal
|
||||
from helpers.helper_app import Helper_App
|
||||
from models.model_view_base import Model_View_Base
|
||||
|
||||
# external
|
||||
@@ -21,5 +22,5 @@ class Model_View_Admin(Model_View_Base):
|
||||
|
||||
def __init__(self, hash_page_current, **kwargs):
|
||||
_m = 'Model_View_Admin.__init__'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
super().__init__(hash_page_current=hash_page_current, **kwargs)
|
||||
@@ -17,15 +17,16 @@ Base data model for views
|
||||
# IMPORTS
|
||||
# internal
|
||||
# from routes import bp_home
|
||||
import lib.argument_validation as av
|
||||
from forms.forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from business_objects.base import Base
|
||||
from business_objects.store.product_category import Product_Category
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
from business_objects.user import User, User_Filters
|
||||
from datastores.datastore_base import DataStore_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.forms import Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from forms.unit_measurement import Filters_Unit_Measurement
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from abc import ABC, abstractmethod
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
@@ -243,7 +244,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# Initialiser - validation
|
||||
_m = 'Model_View_Base.__new__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
# return super().__new__(cls, *args, **kwargs)
|
||||
av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type)
|
||||
return super(Model_View_Base, cls).__new__(cls)
|
||||
@@ -253,7 +254,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
"""
|
||||
_m = 'Model_View_Base.__init__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
av.val_instance(db, 'db', _m, SQLAlchemy, v_arg_type=v_arg_type)
|
||||
"""
|
||||
BaseModel.__init__(self, hash_page_current=hash_page_current, **kwargs)
|
||||
@@ -261,9 +262,9 @@ class Model_View_Base(BaseModel, ABC):
|
||||
self.db = db
|
||||
self.session = session
|
||||
info_user = self.get_info_user()
|
||||
print(f'info_user: {info_user}\ntype: {str(type(info_user))}')
|
||||
Helper_App.console_log(f'info_user: {info_user}\ntype: {str(type(info_user))}')
|
||||
self.is_user_logged_in = ('sub' in list(info_user.keys()) and not info_user['sub'] == '' and not str(type(info_user['sub'])) == "<class 'NoneType'?")
|
||||
print(f'is_user_logged_in: {self.is_user_logged_in}')
|
||||
Helper_App.console_log(f'is_user_logged_in: {self.is_user_logged_in}')
|
||||
self.id_user = info_user['sub'] if self.is_user_logged_in else ''
|
||||
self.app = app
|
||||
"""
|
||||
@@ -274,12 +275,12 @@ class Model_View_Base(BaseModel, ABC):
|
||||
# self.form_delivery_region = Form_Delivery_Region()
|
||||
# self.form_currency = Form_Currency()
|
||||
self.is_page_store = False
|
||||
print(f'session: {self.session}')
|
||||
Helper_App.console_log(f'session: {self.session}')
|
||||
|
||||
datastore_user = DataStore_User()
|
||||
self.user = datastore_user.get_user_session()
|
||||
self.is_user_logged_in = self.user.is_logged_in
|
||||
print(f'model_view_base init end - model.user: {self.user}')
|
||||
Helper_App.console_log(f'model_view_base init end - model.user: {self.user}')
|
||||
|
||||
def output_bool(self, boolean):
|
||||
return str(boolean).lower()
|
||||
@@ -364,7 +365,7 @@ class Model_View_Base(BaseModel, ABC):
|
||||
if preview_str != '':
|
||||
preview_str += '\n'
|
||||
obj_json = obj.to_json()
|
||||
print(f'obj_json: {obj_json}')
|
||||
Helper_App.console_log(f'obj_json: {obj_json}')
|
||||
preview_str += obj_json[obj_json[Base.FLAG_NAME_ATTR_OPTION_TEXT]]
|
||||
return preview_str
|
||||
@staticmethod
|
||||
|
||||
@@ -29,6 +29,7 @@ from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from datastores.datastore_user import DataStore_User
|
||||
from datastores.datastore_store_basket import DataStore_Store_Basket
|
||||
from forms.forms import Form_Basket_Edit, Form_Is_Included_VAT, Form_Delivery_Region, Form_Currency
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
from models.model_view_base import Model_View_Base
|
||||
# external
|
||||
@@ -212,7 +213,7 @@ class Model_View_Store(Model_View_Base):
|
||||
# Initialiser - validation
|
||||
_m = 'Model_View_Store.__new__'
|
||||
v_arg_type = 'class attribute'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
# av.val_str(id_user, 'id_user', _m)
|
||||
# return super().__new__(cls, *args, **kwargs)
|
||||
# cls.FLAG_BUTTON_BASKET_ADD = cls.FLAG_BUTTON_SUBMIT + '.buttonAddToBasket'
|
||||
@@ -225,7 +226,7 @@ class Model_View_Store(Model_View_Base):
|
||||
def __init__(self, hash_page_current, **kwargs): # , id_currency, id_region_delivery, is_included_VAT):
|
||||
# Constructor
|
||||
_m = 'Model_View_Store.__init__'
|
||||
print(f'{_m}\nstarting')
|
||||
Helper_App.console_log(f'{_m}\nstarting')
|
||||
super().__init__(hash_page_current=hash_page_current, **kwargs)
|
||||
self.is_page_store = True
|
||||
"""
|
||||
@@ -279,7 +280,7 @@ class Model_View_Store(Model_View_Base):
|
||||
|
||||
def get_many_product_image_src(self, product_id, image_ids = '', get_primary_only = True, resolution_level = ''):
|
||||
_m = 'Model_View_Store.get_many_product_image'
|
||||
# print(f'{_m}\n')
|
||||
# Helper_App.console_log(f'{_m}\n')
|
||||
# av.val_instance(filters, 'filters', _m, Product_Image_Filters)
|
||||
av.val_int(product_id, 'product_id', _m)
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
@@ -324,14 +325,14 @@ class Model_View_Store(Model_View_Base):
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
# product_id = int(product_id)
|
||||
# av.val_instance(db, 'db', _m, SQLAlchemy)
|
||||
print(f'{_m} starting')
|
||||
# print(f'product_id: {product_id}\npermutation_id: {permutation_id}\nquantity = {quantity}')
|
||||
Helper_App.console_log(f'{_m} starting')
|
||||
# Helper_App.console_log(f'product_id: {product_id}\npermutation_id: {permutation_id}\nquantity = {quantity}')
|
||||
# av.full_val_int(product_id, 'product_id', _m)
|
||||
# print('valid product id')
|
||||
# Helper_App.console_log('valid product id')
|
||||
av.full_val_int(quantity, 'quantity', _m)
|
||||
quantity = int(quantity)
|
||||
# item_added = False
|
||||
print(f'basket: {self.basket}')
|
||||
Helper_App.console_log(f'basket: {self.basket}')
|
||||
ids_permutation, quantities_permutation = self.basket.to_csv()
|
||||
self.basket = DataStore_Store_Basket().edit_basket(ids_permutation, quantities_permutation, permutation_id, quantity, quantity_sum_not_replace, self.id_currency, self.id_region_delivery, self.is_included_VAT)
|
||||
return True
|
||||
@@ -360,14 +361,14 @@ class Model_View_Store(Model_View_Base):
|
||||
permutation_ids += id_permutation # str(basket[b].product.id)
|
||||
# item_index_dict[Basket.get_key_product_index_from_ids_product_permutation(id_product, id_permutation)] = index_item
|
||||
item_index_dict[id_permutation] = index_item
|
||||
print(f'product_ids = {product_ids}')
|
||||
print(f'permutation_ids = {permutation_ids}')
|
||||
Helper_App.console_log(f'product_ids = {product_ids}')
|
||||
Helper_App.console_log(f'permutation_ids = {permutation_ids}')
|
||||
return product_ids, permutation_ids, item_index_dict
|
||||
|
||||
def _get_basket_from_json(self, json_data):
|
||||
basket = json_data[self.KEY_BASKET]['items']
|
||||
av.val_instance(basket, 'basket', 'Model_View_Store._get_basket_from_json', list)
|
||||
print(f'basket = {basket}')
|
||||
Helper_App.console_log(f'basket = {basket}')
|
||||
return basket
|
||||
|
||||
def import_JSON_basket(self, json_data):
|
||||
@@ -378,7 +379,7 @@ class Model_View_Store(Model_View_Base):
|
||||
id_currency = basket[self.KEY_ID_CURRENCY]
|
||||
id_region_delivery = basket[self.KEY_ID_REGION_DELIVERY]
|
||||
is_included_VAT = basket[self.KEY_IS_INCLUDED_VAT]
|
||||
print(f'json basket items: {items}')
|
||||
Helper_App.console_log(f'json basket items: {items}')
|
||||
product_ids, permutation_ids, item_index_dict = self._get_json_basket_id_CSVs_product_permutation(items)
|
||||
category_list, errors = DataStore_Store_Base().get_many_product(Parameters_Product(
|
||||
self.id_user, # :a_id_user
|
||||
@@ -390,7 +391,7 @@ class Model_View_Store(Model_View_Base):
|
||||
False, str(id_currency), False, # :a_get_all_currency, :a_ids_currency, :a_get_inactive_currency
|
||||
True, '', False # :a_get_all_discount, :a_ids_discount, :a_get_inactive_discount
|
||||
)) # product_ids=product_ids, get_all_category=False, get_all_product=False)
|
||||
# print(f'categories = {categories}')
|
||||
# Helper_App.console_log(f'categories = {categories}')
|
||||
self.basket = Basket(id_currency, id_region_delivery, is_included_VAT)
|
||||
if len(category_list.categories) > 0: # not (categories is None):
|
||||
for category in category_list.categories:
|
||||
@@ -404,8 +405,8 @@ class Model_View_Store(Model_View_Base):
|
||||
if len(items) > 0:
|
||||
for index_item in range(len(items)):
|
||||
"""
|
||||
print(f'basket data: {json_data}')
|
||||
print(f'basket: {self.basket}')
|
||||
Helper_App.console_log(f'basket data: {json_data}')
|
||||
Helper_App.console_log(f'basket: {self.basket}')
|
||||
|
||||
# ids_permutation_unavailable_region_or_currency = []
|
||||
# id_permutation_unavailable_otherwise = []
|
||||
@@ -445,11 +446,11 @@ class Model_View_Store(Model_View_Base):
|
||||
|
||||
def import_JSON_basket_item(self, json_data, form_basket = None):
|
||||
_m = 'Model_View_Store.import_JSON_basket_item'
|
||||
print(f'starting {_m}')
|
||||
# print('getting product id')
|
||||
Helper_App.console_log(f'starting {_m}')
|
||||
# Helper_App.console_log('getting product id')
|
||||
# product_id = av.input_int(json_data[self.key_id_product], self.key_id_product, _m)
|
||||
|
||||
# print(f'product id: {product_id}, type: {str(type(product_id))}')
|
||||
# Helper_App.console_log(f'product id: {product_id}, type: {str(type(product_id))}')
|
||||
try:
|
||||
permutation_id = json_data[self.KEY_ID_PERMUTATION]
|
||||
av.full_val_int(permutation_id, self.KEY_ID_PERMUTATION, _m)
|
||||
@@ -457,21 +458,21 @@ class Model_View_Store(Model_View_Base):
|
||||
except:
|
||||
permutation_id = None
|
||||
if not permutation_id == 'None':
|
||||
print(f'permutation_id invalid: {permutation_id}')
|
||||
Helper_App.console_log(f'permutation_id invalid: {permutation_id}')
|
||||
raise ValueError("Invalid permutation id")
|
||||
print(f'permutation_id: {permutation_id}')
|
||||
Helper_App.console_log(f'permutation_id: {permutation_id}')
|
||||
|
||||
try:
|
||||
print(f'form_basket: {form_basket}')
|
||||
print('getting quantity')
|
||||
print(f'form_basket.quantity: {form_basket.quantity}')
|
||||
print(f'form_basket.quantity.data: {form_basket.quantity.data}')
|
||||
Helper_App.console_log(f'form_basket: {form_basket}')
|
||||
Helper_App.console_log('getting quantity')
|
||||
Helper_App.console_log(f'form_basket.quantity: {form_basket.quantity}')
|
||||
Helper_App.console_log(f'form_basket.quantity.data: {form_basket.quantity.data}')
|
||||
quantity = int(form_basket.quantity.data)
|
||||
except:
|
||||
quantity = 0
|
||||
print(f'quantity: {quantity}')
|
||||
Helper_App.console_log(f'quantity: {quantity}')
|
||||
|
||||
print(f'permutation_id: {permutation_id}\nquantity: {quantity}')
|
||||
Helper_App.console_log(f'permutation_id: {permutation_id}\nquantity: {quantity}')
|
||||
|
||||
return permutation_id, quantity
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from business_objects.store.product import Product, Parameters_Product
|
||||
from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.manufacturing_purchase_order import Manufacturing_Purchase_Order, Parameters_Manufacturing_Purchase_Order, Manufacturing_Purchase_Order_Product_Link
|
||||
from forms.store.manufacturing_purchase_order import Filters_Manufacturing_Purchase_Order
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from typing import ClassVar
|
||||
@@ -41,7 +42,7 @@ class Model_View_Store_Manufacturing_Purchase_Order(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_MANUFACTURING_PURCHASE_ORDERS):
|
||||
_m = 'Model_View_Store_Manufacturing.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
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 # Filters_Manufacturing_Purchase_Order.from_json(form_filters_old.to_json())
|
||||
parameters_manufacturing_purchase_order = Parameters_Manufacturing_Purchase_Order.from_filters_manufacturing_purchase_order(form_filters_old)
|
||||
|
||||
@@ -21,6 +21,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from datastores.datastore_store_product import DataStore_Store_Product
|
||||
from forms.access_level import Filters_Access_Level
|
||||
from forms.store.product import Filters_Product
|
||||
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
|
||||
@@ -40,9 +41,9 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
def __init__(self, id_permutation, id_currency, id_region_delivery, is_included_VAT, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
||||
# Constructor
|
||||
_m = 'Model_View_Store_Product.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, id_currency=id_currency, id_region_delivery=id_region_delivery, is_included_VAT=is_included_VAT)
|
||||
print('supered')
|
||||
Helper_App.console_log('supered')
|
||||
|
||||
category_list = DataStore_Store_Base().get_many_product(Parameters_Product(
|
||||
self.info_user['sub'],
|
||||
@@ -54,7 +55,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
False, str(id_currency), False,
|
||||
True, '', False
|
||||
)) # product_ids=str(id_product), permutation_ids=str(id_permutation))
|
||||
print('connection to db successful')
|
||||
Helper_App.console_log('connection to db successful')
|
||||
# self.categories = categories
|
||||
# self.category_index = category_index
|
||||
""
|
||||
@@ -62,7 +63,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
self.product = category_list.get_permutation_first()
|
||||
else:
|
||||
self.product = None
|
||||
print('selected permutation selected')
|
||||
Helper_App.console_log('selected permutation selected')
|
||||
""
|
||||
"""
|
||||
|
||||
@@ -88,7 +89,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCTS):
|
||||
_m = 'Model_View_Store_Product.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
||||
self.access_levels = self.get_many_access_level(Filters_Access_Level())
|
||||
parameters_product = Parameters_Product.from_form_filters_product(self.form_filters)
|
||||
@@ -97,7 +98,7 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
countProducts = 0
|
||||
for category in self.category_list.categories:
|
||||
countProducts += len(category.products)
|
||||
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
self.category_list_filters, errors_filters = datastore_store.get_many_product(
|
||||
Parameters_Product(
|
||||
get_all_product_category = True,
|
||||
@@ -115,16 +116,16 @@ class Model_View_Store_Product(Model_View_Store):
|
||||
get_products_quantity_stock_below_min = parameters_product.get_products_quantity_stock_below_min
|
||||
)
|
||||
)
|
||||
print(f'category filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
self.units_measurement_time = [unit_measurement for unit_measurement in self.units_measurement if unit_measurement.is_unit_of_time]
|
||||
self.currencies = self.get_many_currency()
|
||||
self.currency_options = [currency.to_json_option() for currency in self.currencies]
|
||||
|
||||
print(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
Helper_App.console_log(f'category count: {len(self.category_list.categories)}\nproduct count: {countProducts}')
|
||||
@staticmethod
|
||||
def save_products(comment, list_products):
|
||||
_m = 'Model_View_Store_Product.save_products'
|
||||
|
||||
@@ -21,6 +21,7 @@ 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
|
||||
|
||||
# external
|
||||
@@ -40,7 +41,7 @@ class Model_View_Store_Product_Category(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCT_CATEGORIES):
|
||||
_m = 'Model_View_Store_Product_Category.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters) # filters_category=filters_category)
|
||||
# BaseModel.__init__(self, app=app, filters_product=filters_product, **kwargs)
|
||||
self.access_levels = self.get_many_access_level(Filters_Access_Level())
|
||||
|
||||
@@ -18,6 +18,7 @@ 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
|
||||
|
||||
# external
|
||||
@@ -44,7 +45,7 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters, hash_page_current=Model_View_Store.HASH_PAGE_STORE_PRODUCT_PERMUTATIONS):
|
||||
_m = 'Model_View_Store_Permutation.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, form_filters=form_filters)
|
||||
# self.form_filters = Filters_Product_Permutation()
|
||||
filters_product = Parameters_Product.from_form_filters_product_permutation(self.form_filters)
|
||||
@@ -67,11 +68,11 @@ class Model_View_Store_Product_Permutation(Model_View_Store):
|
||||
get_products_quantity_stock_below_min = filters_product.get_products_quantity_stock_below_min
|
||||
)
|
||||
)
|
||||
print(f'category filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories]
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
self.list_options_product = self.category_list_filters.to_product_option_list()
|
||||
print(f'product options: {self.list_options_product}')
|
||||
Helper_App.console_log(f'product options: {self.list_options_product}')
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in self.list_options_product]
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
self.units_measurement = self.get_many_unit_measurement()
|
||||
|
||||
@@ -18,6 +18,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.product import Product, Parameters_Product, Product_Permutation
|
||||
from business_objects.store.stock_item import Stock_Item, Parameters_Stock_Item
|
||||
from forms.store.stock_item import Filters_Stock_Item
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
# external
|
||||
@@ -43,7 +44,7 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
|
||||
def __init__(self, filters_stock_item, hash_page_current=Model_View_Store.HASH_PAGE_STORE_STOCK_ITEMS):
|
||||
_m = 'Model_View_Store_Stock_Item.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
Helper_App.console_log(f'{_m}\nstarting...')
|
||||
super().__init__(hash_page_current=hash_page_current, filters_stock_item=filters_stock_item)
|
||||
# BaseModel.__init__(self, app=app, filters_stock_item=filters_stock_item, **kwargs)
|
||||
self.form_filters = Filters_Stock_Item.from_json(filters_stock_item.to_json()) # .from_form_stock_item(filters_stock_item)
|
||||
@@ -68,17 +69,17 @@ class Model_View_Store_Stock_Item(Model_View_Store):
|
||||
)
|
||||
"""
|
||||
|
||||
print(f'category_list_filters: {self.category_list_filters.categories}')
|
||||
Helper_App.console_log(f'category_list_filters: {self.category_list_filters.categories}')
|
||||
self.form_filters.id_category.choices += [(str(category.id_category), category.name) for category in self.category_list_filters.categories] # [Filters_Stock_Item.get_choice_all()] +
|
||||
print(f'category options: {self.form_filters.id_category.choices}')
|
||||
Helper_App.console_log(f'category options: {self.form_filters.id_category.choices}')
|
||||
product_list = self.category_list_filters.to_product_option_list()
|
||||
filtered_product_list = []
|
||||
if product_list is not None:
|
||||
for product in product_list:
|
||||
# print(f'product: {product}\n{product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]}\n{self.form_filters.id_category.data}\n{str(type(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]))}\n{str(type(self.form_filters.id_category.data))}')
|
||||
# Helper_App.console_log(f'product: {product}\n{product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]}\n{self.form_filters.id_category.data}\n{str(type(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]))}\n{str(type(self.form_filters.id_category.data))}')
|
||||
if (self.form_filters.id_category.data == '' or str(product[Stock_Item.ATTR_ID_PRODUCT_CATEGORY]) == self.form_filters.id_category.data):
|
||||
filtered_product_list.append(product)
|
||||
print(f'product_list: {product_list}\nfiltered_product_list: {filtered_product_list}')
|
||||
Helper_App.console_log(f'product_list: {product_list}\nfiltered_product_list: {filtered_product_list}')
|
||||
self.form_filters.id_product.choices += [(str(product['value']), product['text']) for product in filtered_product_list] # [Filters_Stock_Item.get_choice_all()] +
|
||||
# self.form_filters.import_values(filters_stock_item)
|
||||
self.variation_types, self.variations, errors = self.get_many_product_variation()
|
||||
|
||||
@@ -15,6 +15,7 @@ from models.model_view_store import Model_View_Store
|
||||
from datastores.datastore_store_supplier import DataStore_Store_Supplier
|
||||
from business_objects.store.supplier import Supplier, Parameters_Supplier
|
||||
from forms.store.supplier import Filters_Supplier
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from typing import ClassVar
|
||||
@@ -39,7 +40,7 @@ class Model_View_Store_Supplier(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_SUPPLIERS):
|
||||
_m = 'Model_View_Store_Supplier.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
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 # Filters_Supplier.from_json(form_filters_old.to_json())
|
||||
parameters_supplier = Parameters_Supplier.from_filters_supplier(self.form_filters)
|
||||
|
||||
@@ -19,6 +19,7 @@ from business_objects.store.product_category import Product_Category_Container
|
||||
from business_objects.store.supplier import Supplier, Parameters_Supplier
|
||||
from business_objects.store.supplier_purchase_order import Supplier_Purchase_Order, Parameters_Supplier_Purchase_Order
|
||||
from forms.store.supplier_purchase_order import Filters_Supplier_Purchase_Order
|
||||
from helpers.helper_app import Helper_App
|
||||
import lib.argument_validation as av
|
||||
|
||||
class Model_View_Store_Supplier_Purchase_Order(Model_View_Store):
|
||||
@@ -40,7 +41,7 @@ class Model_View_Store_Supplier_Purchase_Order(Model_View_Store):
|
||||
|
||||
def __init__(self, form_filters_old, hash_page_current=Model_View_Store.HASH_PAGE_STORE_SUPPLIER_PURCHASE_ORDERS):
|
||||
_m = 'Model_View_Store_Supplier.__init__'
|
||||
print(f'{_m}\nstarting...')
|
||||
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 # Filters_Supplier_Purchase_Order.from_json(form_filters_old.to_json())
|
||||
parameters_supplier_purchase_order = Parameters_Supplier_Purchase_Order.from_filters_supplier_purchase_order(self.form_filters)
|
||||
|
||||
Reference in New Issue
Block a user