Add start date support for "future" pricing batch
This commit is contained in:
parent
cb6499522e
commit
6b466bb90f
3 changed files with 68 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -52,6 +52,7 @@ class PricingBatchView(BatchMasterView):
|
|||
bulk_deletable = True
|
||||
rows_editable = True
|
||||
rows_bulk_deletable = True
|
||||
configurable = True
|
||||
|
||||
labels = {
|
||||
'min_diff_threshold': "Min $ Diff",
|
||||
|
@ -62,6 +63,7 @@ class PricingBatchView(BatchMasterView):
|
|||
grid_columns = [
|
||||
'id',
|
||||
'description',
|
||||
'start_date',
|
||||
'created',
|
||||
'created_by',
|
||||
'rowcount',
|
||||
|
@ -75,6 +77,7 @@ class PricingBatchView(BatchMasterView):
|
|||
'id',
|
||||
'input_filename',
|
||||
'description',
|
||||
'start_date',
|
||||
'min_diff_threshold',
|
||||
'min_diff_percent',
|
||||
'calculate_for_manual',
|
||||
|
@ -147,8 +150,24 @@ class PricingBatchView(BatchMasterView):
|
|||
'status_text',
|
||||
]
|
||||
|
||||
def allow_future_pricing(self):
|
||||
return self.batch_handler.allow_future()
|
||||
|
||||
def configure_form(self, f):
|
||||
super(PricingBatchView, self).configure_form(f)
|
||||
app = self.get_rattail_app()
|
||||
batch = f.model_instance
|
||||
|
||||
if self.creating or self.editing:
|
||||
if self.allow_future_pricing():
|
||||
f.set_type('start_date', 'date_jquery')
|
||||
f.set_helptext('start_date', "Only set this for a \"FUTURE\" batch.")
|
||||
else:
|
||||
f.remove('start_date')
|
||||
else: # viewing or deleting
|
||||
if not self.allow_future_pricing():
|
||||
if not batch.start_date:
|
||||
f.remove('start_date')
|
||||
|
||||
f.set_type('min_diff_threshold', 'currency')
|
||||
|
||||
|
@ -349,6 +368,15 @@ class PricingBatchView(BatchMasterView):
|
|||
|
||||
return xlrow
|
||||
|
||||
def configure_get_simple_settings(self):
|
||||
return [
|
||||
|
||||
# options
|
||||
{'section': 'rattail.batch',
|
||||
'option': 'pricing.allow_future',
|
||||
'type': bool},
|
||||
]
|
||||
|
||||
|
||||
def includeme(config):
|
||||
PricingBatchView.defaults(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue