Add ability to make new pricing batch from input data file

This commit is contained in:
Lance Edgar 2018-12-17 22:35:56 -06:00
parent 6a643411a4
commit d61d9cc574

View file

@ -44,7 +44,8 @@ class PricingBatchView(BatchMasterView):
route_prefix = 'batch.pricing' route_prefix = 'batch.pricing'
url_prefix = '/batches/pricing' url_prefix = '/batches/pricing'
template_prefix = '/batch/pricing' template_prefix = '/batch/pricing'
creatable = False creatable = True
downloadable = True
bulk_deletable = True bulk_deletable = True
rows_editable = True rows_editable = True
rows_bulk_deletable = True rows_bulk_deletable = True
@ -68,6 +69,7 @@ class PricingBatchView(BatchMasterView):
form_fields = [ form_fields = [
'id', 'id',
'input_filename',
'description', 'description',
'min_diff_threshold', 'min_diff_threshold',
'min_diff_percent', 'min_diff_percent',
@ -136,6 +138,20 @@ class PricingBatchView(BatchMasterView):
f.set_type('min_diff_threshold', 'currency') f.set_type('min_diff_threshold', 'currency')
# input_filename
if self.creating:
f.set_type('input_filename', 'file')
else:
f.set_readonly('input_filename')
f.set_renderer('input_filename', self.render_downloadable_file)
def get_batch_kwargs(self, batch, mobile=False):
kwargs = super(PricingBatchView, self).get_batch_kwargs(batch, mobile=mobile)
kwargs['min_diff_threshold'] = batch.min_diff_threshold
kwargs['min_diff_percent'] = batch.min_diff_percent
kwargs['calculate_for_manual'] = batch.calculate_for_manual
return kwargs
def configure_row_grid(self, g): def configure_row_grid(self, g):
super(PricingBatchView, self).configure_row_grid(g) super(PricingBatchView, self).configure_row_grid(g)