Fix: Cleanup \n 1. Remove PostgreSQL \n 2. Remove comments from Python \n 3. Remove non-demo ERP Python code \n 4. Remove deprecated Python code
This commit is contained in:
@@ -21,15 +21,7 @@ class Form_Base_Meta(type(FlaskForm), ABCMeta):
|
||||
|
||||
|
||||
class Form_Base(FlaskForm, metaclass=Form_Base_Meta):
|
||||
"""
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def from_filters(cls, filters):
|
||||
pass
|
||||
@abstractmethod
|
||||
def __repr__(self):
|
||||
pass
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
fields = ', '.join(
|
||||
f"{name}={field.data}" for name, field in self._fields.items()
|
||||
@@ -42,37 +34,9 @@ class Form_Base(FlaskForm, metaclass=Form_Base_Meta):
|
||||
@classmethod
|
||||
def get_default(cls):
|
||||
return cls()
|
||||
"""
|
||||
@abstractmethod
|
||||
def test_69(self):
|
||||
pass
|
||||
|
||||
def get_Filters_Product_Category(data_request):
|
||||
data_form = data_request[Model_View_Store_Product_Category.FLAG_FORM]
|
||||
form_filters = Filters_Product_Category(**data_form)
|
||||
form_filters.is_not_empty.data = av.input_bool(data_form['is_not_empty'], 'is_not_empty', 'filter_category')
|
||||
form_filters.active.data = av.input_bool(data_form['active'], 'active', 'filter_category')
|
||||
return form_filters
|
||||
"""
|
||||
@classmethod
|
||||
def get_choices_blank(cls):
|
||||
return [('', 'Select')]
|
||||
@classmethod
|
||||
def get_choice_all(cls):
|
||||
return ('', 'All')
|
||||
|
||||
'''
|
||||
class Filters_Stored_Procedure_Base(Form_Base):
|
||||
"""
|
||||
@abstractmethod
|
||||
def __repr__(self):
|
||||
pass
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def from_json(cls, json):
|
||||
pass
|
||||
"""
|
||||
@abstractmethod
|
||||
def to_json(self):
|
||||
pass
|
||||
'''
|
||||
@@ -40,43 +40,24 @@ class Form_Register(FlaskForm):
|
||||
submit = SubmitField('Submit')
|
||||
|
||||
|
||||
"""
|
||||
class Form_Product(FlaskForm): # for basket, product tiles, product add
|
||||
# PositiveIntegerField with validation constraints
|
||||
class Form_Basket_Add(FlaskForm):
|
||||
quantity = IntegerField(
|
||||
'Quantity',
|
||||
validators=[
|
||||
# InputRequired(message='Quantity'),
|
||||
validators = [
|
||||
NumberRange(min=1, message='Please enter a positive integer')
|
||||
],
|
||||
default=1
|
||||
)
|
||||
"""
|
||||
|
||||
class Form_Basket_Add(FlaskForm): # for basket, product tiles, product add
|
||||
# PositiveIntegerField with validation constraints
|
||||
quantity = IntegerField(
|
||||
'Quantity',
|
||||
validators=[
|
||||
# InputRequired(message='Quantity'),
|
||||
NumberRange(min=1, message='Please enter a positive integer')
|
||||
],
|
||||
default=1
|
||||
# render_kw={'id-product': ''} # {Model_View_Store.attr_id_product: ''}
|
||||
default = 1
|
||||
)
|
||||
submit = SubmitField('Add')
|
||||
form_type = 'Form_Basket_Add'
|
||||
|
||||
class Form_Basket_Edit(FlaskForm): # for basket, product tiles, product add
|
||||
# PositiveIntegerField with validation constraints
|
||||
class Form_Basket_Edit(FlaskForm):
|
||||
quantity = IntegerField(
|
||||
'Quantity',
|
||||
validators=[
|
||||
# InputRequired(message='Quantity'),
|
||||
validators = [
|
||||
NumberRange(min=1, message='Please enter a positive integer')
|
||||
],
|
||||
default=1
|
||||
# render_kw={'id-product': ''} # {Model_View_Store.attr_id_product: ''}
|
||||
default = 1
|
||||
)
|
||||
submit = SubmitField('Update')
|
||||
form_type = 'Form_Basket_Edit'
|
||||
@@ -109,7 +90,6 @@ class Form_Currency(FlaskForm):
|
||||
id_currency = SelectField('Currency', id='id_currency')
|
||||
|
||||
|
||||
# Store
|
||||
class Form_Supplier(FlaskForm):
|
||||
id_id_supplier = 'id_supplier'
|
||||
id_supplier = SelectField('Supplier', id='id_supplier')
|
||||
@@ -124,11 +104,8 @@ class Form_Supplier(FlaskForm):
|
||||
id_currency = SelectField('Currency ID')
|
||||
is_active = BooleanField('Active', default = True)
|
||||
|
||||
# class Form_Supplier_Purchase_Order(FlaskForm):
|
||||
|
||||
|
||||
|
||||
# User
|
||||
class Form_Filters_User(FlaskForm):
|
||||
active = BooleanField('Active only?', default = True)
|
||||
id_user = SelectField('User ID', validators=[Optional()], choices=[])
|
||||
@@ -28,14 +28,7 @@ from abc import ABCMeta, abstractmethod
|
||||
class Filters_Product_Category(Form_Base):
|
||||
is_not_empty = BooleanField('Not empty only?')
|
||||
active = BooleanField("Active only?", default = True)
|
||||
"""
|
||||
@classmethod
|
||||
def from_filters(cls, filters):
|
||||
form = Filters_Product_Category()
|
||||
form.is_not_empty.data = filters.is_not_empty
|
||||
form.active.data = filters.active
|
||||
return form
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
return f'Filters_Product_Category(is_not_empty={self.is_not_empty.data}, active={self.active.data})'
|
||||
@classmethod
|
||||
|
||||
@@ -32,18 +32,7 @@ class Filters_Product_Permutation(Form_Base):
|
||||
active = BooleanField('Active only?', default=True)
|
||||
quantity_min = FloatField('Min stock')
|
||||
quantity_max = FloatField('Max stock')
|
||||
# submit = SubmitField('Submit')
|
||||
"""
|
||||
@classmethod
|
||||
def from_filters(cls, filters):
|
||||
form = Filters_Product_Permutation()
|
||||
form.id_category.choices = Store_Base.convert_list_objects_to_list_options(filters.categories)
|
||||
form.id_product.choices = Store_Base.convert_list_objects_to_list_options(filters.products)
|
||||
form.is_out_of_stock.data = filters.is_out_of_stock
|
||||
form.quantity_min.data = filters.quantity_min
|
||||
form.quantity_max.data = filters.quantity_max
|
||||
return form
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
return f'''
|
||||
Filters_Product_Permutation(
|
||||
|
||||
@@ -31,24 +31,11 @@ class Filters_Stock_Item(Form_Base):
|
||||
quantity_min = FloatField('Min stock')
|
||||
quantity_max = FloatField('Max stock')
|
||||
active = BooleanField("Active")
|
||||
# submit = SubmitField('Submit')
|
||||
"""
|
||||
def __repr__(self):
|
||||
return f'''
|
||||
{self.__class__.__name__}(
|
||||
id_category={self.id_category.data},
|
||||
id_product={self.id_product.data},
|
||||
is_out_of_stock={self.is_out_of_stock.data},
|
||||
quantity_min={self.quantity_min.data},
|
||||
quantity_max={self.quantity_max.data})
|
||||
'''
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json):
|
||||
form = cls()
|
||||
# form.id_category.choices = [(json[Store_Base.ATTR_ID_PRODUCT_CATEGORY], json[Store_Base.ATTR_ID_PRODUCT_CATEGORY])]
|
||||
form.id_category.data = json[Store_Base.ATTR_ID_PRODUCT_CATEGORY]
|
||||
# form.id_product.choices = [(json[Store_Base.ATTR_ID_PRODUCT], json[Store_Base.ATTR_ID_PRODUCT])]
|
||||
form.id_product.data = json[Store_Base.ATTR_ID_PRODUCT]
|
||||
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]
|
||||
@@ -69,11 +56,4 @@ class Filters_Stock_Item(Form_Base):
|
||||
filters = cls()
|
||||
filters.id_category.choices = cls.get_choices_blank()
|
||||
filters.id_product.choices = cls.get_choices_blank()
|
||||
"""
|
||||
def import_values(self, form_filters):
|
||||
self.id_category.data = form_filters.id_category.data
|
||||
self.id_product.data = form_filters.id_product.data
|
||||
self.is_out_of_stock.data = form_filters.is_out_of_stock.data
|
||||
self.quantity_min.data = form_filters.quantity_min.data
|
||||
self.quantity_max.data = form_filters.quantity_max.data
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user