Add views for "delete product" batch

This commit is contained in:
Lance Edgar 2021-01-19 12:18:56 -06:00
parent af99ca7905
commit f480c046f6
2 changed files with 99 additions and 5 deletions

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2020 Lance Edgar
# Copyright © 2010-2021 Lance Edgar
#
# This file is part of Rattail.
#
@ -1583,10 +1583,20 @@ class ProductsView(MasterView):
return {'product': data}
def get_supported_batches(self):
return {
'labels': 'rattail.batch.labels:LabelBatchHandler',
'pricing': 'rattail.batch.pricing:PricingBatchHandler',
}
return OrderedDict([
('labels', {
'spec': self.rattail_config.get('rattail.batch', 'labels.handler',
default='rattail.batch.labels:LabelBatchHandler'),
}),
('pricing', {
'spec': self.rattail_config.get('rattail.batch', 'pricing.handler',
default='rattail.batch.pricing:PricingBatchHandler'),
}),
('delproduct', {
'spec': self.rattail_config.get('rattail.batch', 'delproduct.handler',
default='rattail.batch.delproduct:DeleteProductBatchHandler'),
}),
])
def make_batch(self):
"""
@ -1716,6 +1726,8 @@ class ProductsView(MasterView):
return self.request.route_url('labels.batch.view', uuid=batch.uuid)
if batch.batch_key == 'pricing':
return self.request.route_url('batch.pricing.view', uuid=batch.uuid)
if batch.batch_key == 'delproduct':
return self.request.route_url('batch.delproduct.view', uuid=batch.uuid)
@classmethod
def defaults(cls, config):