From ec30bdf0857e99a79f3a826973937e42758bc231 Mon Sep 17 00:00:00 2001 From: Teddy Middleton-Smith Date: Fri, 31 Jan 2025 15:23:08 +0000 Subject: [PATCH] Fix(python): Stock Item page filters Form attribute error corrected. --- forms/store/stock_item.py | 5 ++++- static/MySQL/6500_p_shop_calc_user.sql | 6 +++--- static/MySQL/9000_populate.sql | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/forms/store/stock_item.py b/forms/store/stock_item.py index 0388031f..59697782 100644 --- a/forms/store/stock_item.py +++ b/forms/store/stock_item.py @@ -30,6 +30,7 @@ class Filters_Stock_Item(Form_Base): is_out_of_stock = BooleanField('Out of stock only?') quantity_min = FloatField('Min stock') quantity_max = FloatField('Max stock') + active = BooleanField("Active") # submit = SubmitField('Submit') """ def __repr__(self): @@ -52,6 +53,7 @@ class Filters_Stock_Item(Form_Base): form.is_out_of_stock.data = av.input_bool(json[Store_Base.FLAG_IS_OUT_OF_STOCK], Store_Base.FLAG_IS_OUT_OF_STOCK, f'{cls.__name__}.from_json') form.quantity_min.data = json[Store_Base.FLAG_QUANTITY_MIN] form.quantity_max.data = json[Store_Base.FLAG_QUANTITY_MAX] + form.active.data = json[Store_Base.FLAG_ACTIVE] return form def to_json(self): return { @@ -59,7 +61,8 @@ class Filters_Stock_Item(Form_Base): Store_Base.ATTR_ID_PRODUCT: self.id_product.data, Store_Base.FLAG_IS_OUT_OF_STOCK: self.is_out_of_stock.data, Store_Base.FLAG_QUANTITY_MIN: self.quantity_min.data, - Store_Base.FLAG_QUANTITY_MAX: self.quantity_max.data + Store_Base.FLAG_QUANTITY_MAX: self.quantity_max.data, + Store_Base.FLAG_ACTIVE: self.active.data } @classmethod def get_default(cls): diff --git a/static/MySQL/6500_p_shop_calc_user.sql b/static/MySQL/6500_p_shop_calc_user.sql index 261df4f3..a8f938ed 100644 --- a/static/MySQL/6500_p_shop_calc_user.sql +++ b/static/MySQL/6500_p_shop_calc_user.sql @@ -325,7 +325,7 @@ BEGIN ) SELECT U.id_user - , U.is_super_user + , IFNULL(U.is_super_user, 0) AS is_super_user -- , IFNULL(AL_U.id_access_level, v_id_access_level_view) AS id_access_level , IFNULL(MIN(AL_U.priority), v_priority_access_level_view) AS priority_access_level FROM tmp_Split t_S @@ -355,8 +355,8 @@ BEGIN , v_id_permission_required , v_priority_access_level AS priority_access_level_required , NULL - , t_UCU.priority_access_level AS priority_access_level_user , t_UCU.is_super_user AS is_super_user + , t_UCU.priority_access_level AS priority_access_level_user FROM tmp_User_Calc_User t_UCU ; @@ -507,8 +507,8 @@ BEGIN , v_id_permission_required , CASE WHEN AL.priority < v_priority_access_level THEN AL.priority ELSE v_priority_access_level END AS priority_access_level_required , t_P.id_product - , t_U.priority_access_level AS priority_access_level_user , t_U.is_super_user AS is_super_user + , t_U.priority_access_level AS priority_access_level_user FROM tmp_User_Calc_User t_U CROSS JOIN tmp_Product_Calc_User t_P LEFT JOIN partsltd_prod.Shop_Access_Level AL ON t_P.id_access_level_required = AL.id_access_level diff --git a/static/MySQL/9000_populate.sql b/static/MySQL/9000_populate.sql index da1712c0..4ae5db68 100644 --- a/static/MySQL/9000_populate.sql +++ b/static/MySQL/9000_populate.sql @@ -916,7 +916,8 @@ INSERT INTO Shop_User_Role_Link ( id_user, id_role ) VALUES - (1, 1) + (1, 1), + (4, 1) ; # User Addresses