More tweaks to vendor catalog/invoice batches.
Trying to make batch fieldsets simpler to configure...
This commit is contained in:
parent
874fd6d4b3
commit
bc1c7b3554
|
@ -62,7 +62,7 @@ class BatchMasterView(MasterView):
|
||||||
"""
|
"""
|
||||||
Base class for all "batch master" views.
|
Base class for all "batch master" views.
|
||||||
"""
|
"""
|
||||||
refreshable = False
|
refreshable = True
|
||||||
rows_viewable = True
|
rows_viewable = True
|
||||||
rows_creatable = False
|
rows_creatable = False
|
||||||
rows_editable = False
|
rows_editable = False
|
||||||
|
@ -205,6 +205,24 @@ class BatchMasterView(MasterView):
|
||||||
fs.created_by,
|
fs.created_by,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def _postconfigure_fieldset(self, fs):
|
||||||
|
if self.creating:
|
||||||
|
if 'created' in fs.render_fields:
|
||||||
|
del fs.created
|
||||||
|
if 'created_by' in fs.render_fields:
|
||||||
|
del fs.created_by
|
||||||
|
if 'executed' in fs.render_fields:
|
||||||
|
del fs.executed
|
||||||
|
if 'executed_by' in fs.render_fields:
|
||||||
|
del fs.executed_by
|
||||||
|
else:
|
||||||
|
batch = fs.model
|
||||||
|
if not batch.executed:
|
||||||
|
if 'executed' in fs.render_fields:
|
||||||
|
del fs.executed
|
||||||
|
if 'executed_by' in fs.render_fields:
|
||||||
|
del fs.executed_by
|
||||||
|
|
||||||
def save_create_form(self, form):
|
def save_create_form(self, form):
|
||||||
"""
|
"""
|
||||||
Save the uploaded data file if necessary, etc. If batch initialization
|
Save the uploaded data file if necessary, etc. If batch initialization
|
||||||
|
@ -527,7 +545,7 @@ class BatchMasterView(MasterView):
|
||||||
return defaults
|
return defaults
|
||||||
|
|
||||||
def row_grid_row_attrs(self, row, i):
|
def row_grid_row_attrs(self, row, i):
|
||||||
pass
|
return {}
|
||||||
|
|
||||||
def view_row(self):
|
def view_row(self):
|
||||||
"""
|
"""
|
||||||
|
@ -769,7 +787,6 @@ class FileBatchMasterView(BatchMasterView):
|
||||||
"""
|
"""
|
||||||
Base class for all file-based "batch master" views.
|
Base class for all file-based "batch master" views.
|
||||||
"""
|
"""
|
||||||
refreshable = True
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def upload_dir(self):
|
def upload_dir(self):
|
||||||
|
|
7
tailbone/views/vendors/catalogs.py
vendored
7
tailbone/views/vendors/catalogs.py
vendored
|
@ -85,7 +85,6 @@ class VendorCatalogsView(FileBatchMasterView):
|
||||||
parser_options.insert(0, ("(please choose)", ''))
|
parser_options.insert(0, ("(please choose)", ''))
|
||||||
fs.parser_key.set(renderer=formalchemy.fields.SelectFieldRenderer,
|
fs.parser_key.set(renderer=formalchemy.fields.SelectFieldRenderer,
|
||||||
options=parser_options, label="File Type")
|
options=parser_options, label="File Type")
|
||||||
|
|
||||||
fs.configure(
|
fs.configure(
|
||||||
include=[
|
include=[
|
||||||
fs.filename,
|
fs.filename,
|
||||||
|
@ -94,7 +93,6 @@ class VendorCatalogsView(FileBatchMasterView):
|
||||||
])
|
])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
fs.configure(
|
fs.configure(
|
||||||
include=[
|
include=[
|
||||||
fs.vendor.readonly(),
|
fs.vendor.readonly(),
|
||||||
|
@ -106,11 +104,6 @@ class VendorCatalogsView(FileBatchMasterView):
|
||||||
fs.executed_by,
|
fs.executed_by,
|
||||||
])
|
])
|
||||||
|
|
||||||
batch = fs.model
|
|
||||||
if not batch.executed:
|
|
||||||
del fs.executed
|
|
||||||
del fs.executed_by
|
|
||||||
|
|
||||||
def configure_row_grid(self, g):
|
def configure_row_grid(self, g):
|
||||||
g.configure(
|
g.configure(
|
||||||
include=[
|
include=[
|
||||||
|
|
38
tailbone/views/vendors/invoices.py
vendored
38
tailbone/views/vendors/invoices.py
vendored
|
@ -68,6 +68,19 @@ class VendorInvoicesView(FileBatchMasterView):
|
||||||
fs.purchase_order_number.set(validate=self.validate_po_number)
|
fs.purchase_order_number.set(validate=self.validate_po_number)
|
||||||
fs.filename.set(label="Invoice File")
|
fs.filename.set(label="Invoice File")
|
||||||
|
|
||||||
|
fs.configure(
|
||||||
|
include=[
|
||||||
|
fs.vendor.readonly(),
|
||||||
|
fs.filename,
|
||||||
|
fs.parser_key,
|
||||||
|
fs.purchase_order_number,
|
||||||
|
fs.invoice_date.readonly(),
|
||||||
|
fs.created,
|
||||||
|
fs.created_by,
|
||||||
|
fs.executed,
|
||||||
|
fs.executed_by,
|
||||||
|
])
|
||||||
|
|
||||||
if self.creating:
|
if self.creating:
|
||||||
parsers = sorted(iter_invoice_parsers(), key=lambda p: p.display)
|
parsers = sorted(iter_invoice_parsers(), key=lambda p: p.display)
|
||||||
parser_options = [(p.display, p.key) for p in parsers]
|
parser_options = [(p.display, p.key) for p in parsers]
|
||||||
|
@ -75,30 +88,11 @@ class VendorInvoicesView(FileBatchMasterView):
|
||||||
fs.parser_key.set(label="File Type",
|
fs.parser_key.set(label="File Type",
|
||||||
renderer=formalchemy.fields.SelectFieldRenderer,
|
renderer=formalchemy.fields.SelectFieldRenderer,
|
||||||
options=parser_options)
|
options=parser_options)
|
||||||
|
del fs.vendor
|
||||||
fs.configure(
|
del fs.invoice_date
|
||||||
include=[
|
|
||||||
fs.filename,
|
|
||||||
fs.parser_key,
|
|
||||||
fs.purchase_order_number,
|
|
||||||
])
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
fs.configure(
|
del fs.parser_key
|
||||||
include=[
|
|
||||||
fs.vendor.readonly(),
|
|
||||||
fs.filename,
|
|
||||||
fs.purchase_order_number,
|
|
||||||
fs.invoice_date.readonly(),
|
|
||||||
fs.created,
|
|
||||||
fs.created_by,
|
|
||||||
fs.executed,
|
|
||||||
fs.executed_by,
|
|
||||||
])
|
|
||||||
batch = fs.model
|
|
||||||
if not batch.executed:
|
|
||||||
del fs.executed
|
|
||||||
del fs.executed_by
|
|
||||||
|
|
||||||
def validate_po_number(self, value, field):
|
def validate_po_number(self, value, field):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue