Add support for inactivity_months
field for delete product batch
This commit is contained in:
parent
059b24fac7
commit
7532dc5117
|
@ -45,6 +45,19 @@ class DeleteProductBatchView(BatchMasterView):
|
||||||
bulk_deletable = True
|
bulk_deletable = True
|
||||||
rows_bulk_deletable = True
|
rows_bulk_deletable = True
|
||||||
|
|
||||||
|
form_fields = [
|
||||||
|
'id',
|
||||||
|
'description',
|
||||||
|
'notes',
|
||||||
|
'inactivity_months',
|
||||||
|
'created',
|
||||||
|
'created_by',
|
||||||
|
'rowcount',
|
||||||
|
'status_code',
|
||||||
|
'executed',
|
||||||
|
'executed_by',
|
||||||
|
]
|
||||||
|
|
||||||
row_grid_columns = [
|
row_grid_columns = [
|
||||||
'sequence',
|
'sequence',
|
||||||
'upc',
|
'upc',
|
||||||
|
|
|
@ -1608,6 +1608,7 @@ class ProductView(MasterView):
|
||||||
if self.request.method == 'POST':
|
if self.request.method == 'POST':
|
||||||
if form.validate(newstyle=True):
|
if form.validate(newstyle=True):
|
||||||
data = form.validated
|
data = form.validated
|
||||||
|
fully_validated = True
|
||||||
|
|
||||||
# collect general params
|
# collect general params
|
||||||
batch_key = data['batch_type']
|
batch_key = data['batch_type']
|
||||||
|
@ -1617,11 +1618,16 @@ class ProductView(MasterView):
|
||||||
|
|
||||||
# collect batch-type-specific params
|
# collect batch-type-specific params
|
||||||
pform = params_forms.get(batch_key)
|
pform = params_forms.get(batch_key)
|
||||||
if pform and pform.validate(newstyle=True):
|
if pform:
|
||||||
|
if pform.validate(newstyle=True):
|
||||||
pdata = pform.validated
|
pdata = pform.validated
|
||||||
for field in pform.schema:
|
for field in pform.schema:
|
||||||
param_name = pform.schema[field.name].param_name
|
param_name = pform.schema[field.name].param_name
|
||||||
params[param_name] = pdata[field.name]
|
params[param_name] = pdata[field.name]
|
||||||
|
else:
|
||||||
|
fully_validated = False
|
||||||
|
|
||||||
|
if fully_validated:
|
||||||
|
|
||||||
# TODO: should this be done elsewhere?
|
# TODO: should this be done elsewhere?
|
||||||
for name in params:
|
for name in params:
|
||||||
|
@ -1668,6 +1674,17 @@ class ProductView(MasterView):
|
||||||
colander.SchemaNode(colander.Boolean(), name='calculate_for_manual'),
|
colander.SchemaNode(colander.Boolean(), name='calculate_for_manual'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def make_batch_params_schema_delproduct(self):
|
||||||
|
"""
|
||||||
|
Return params schema for making a "delete products" batch.
|
||||||
|
"""
|
||||||
|
return colander.SchemaNode(
|
||||||
|
colander.Mapping(),
|
||||||
|
colander.SchemaNode(colander.Integer(), name='inactivity_months',
|
||||||
|
# TODO: probably should be configurable
|
||||||
|
default=18),
|
||||||
|
)
|
||||||
|
|
||||||
def make_batch_thread(self, handler, user_uuid, products, params, progress):
|
def make_batch_thread(self, handler, user_uuid, products, params, progress):
|
||||||
"""
|
"""
|
||||||
Threat target for making a batch from current products query.
|
Threat target for making a batch from current products query.
|
||||||
|
|
Loading…
Reference in a new issue