diff --git a/tailbone/views/batch/pricing.py b/tailbone/views/batch/pricing.py index 39ef84e0..17faaf58 100644 --- a/tailbone/views/batch/pricing.py +++ b/tailbone/views/batch/pricing.py @@ -44,7 +44,8 @@ class PricingBatchView(BatchMasterView): route_prefix = 'batch.pricing' url_prefix = '/batches/pricing' template_prefix = '/batch/pricing' - creatable = False + creatable = True + downloadable = True bulk_deletable = True rows_editable = True rows_bulk_deletable = True @@ -68,6 +69,7 @@ class PricingBatchView(BatchMasterView): form_fields = [ 'id', + 'input_filename', 'description', 'min_diff_threshold', 'min_diff_percent', @@ -136,6 +138,20 @@ class PricingBatchView(BatchMasterView): 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): super(PricingBatchView, self).configure_row_grid(g)